Git学习

 git开发人员使用流程:

 

 

 

 a. 基本配置
 1.环境变量
 /etc/gitconfig
 .gitconfig

 2.帮助
 git config --help
 git help <verb>
 git <verb> help
 3.用户
 git config --global user.name "gewei"
 git config --global user.email wei_ge163@163.com

 4.编辑器可选
 git config --global core.editor emacs

 5.设置比较工具
 git config --global merge.tool vimdiff
 git config --global user.email wei_ge163@163.com

 6.检查配置项
 git config --list

 git rm 文件名

b.4个区域
1.blessed(remote) repository

2.local repository

3.stage area

4.work area

c.开发人员
1.创建和初始化项目
1.1 本地
    进入文件夹
    git init
    git add.
    git commit -m "描述"
1.2 远程
 git clone 地址
 git remote

2.添加文件
git add *.c
git add README

2.1查看文件状态
git status

2.2 git diff --staged  比较worekspace vs  staged

git diff --cached   staged vs  local repo

git reset 恢复版本

git rm 文件名

git commit -a

查看差异
cat  文件名

查看日志
git log
git  whatchanged

2.3  gitignore
建立 .gitignore 文件 并写忽视文件

2.4共享和更新
git remote
git fetch origin  master(分支名称)
git pull origin

打补丁
git format-patch origin/分支名称

git branch 查看当前分支

2.5 分支与合并
创建分支:git branch gewei(分支名称)
切换分支:git checkout gewei(分支名称)

不同分支差异 :git show-branch
比较分支: git diff master gewei 

合并
1.git merge "日志"  HEAD  分支名称
git tag -a Beta1 -m "make beta1"
git show 分支号

 

四、Git 和 Repo 关系



五、Linux自己安装git

解压git包

unzip  xxx.tar.zip

tar zxvf  xxx.tar.gz


安装

./configure -prefix=/usr/local/git 

make

make install


修改etc/profile文件

export PATH=/usr/local/git/bin:/usr/local/git/libexec/git-core:$PATH

source


查看版本

git version


 


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值