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