1、克隆远程分支到本地
git clone xxxx.git
2、查看当前 tree 状态
git status
3、查看当前分支
git branch
4、如果远程有某个分支A而本地没有,可以先更新远程分支列表到本地
git fetch
5、切换分支
git checkout <branch>
6、文件提交到暂存区
git add . // 提交所有
git add 1.txt //提交1.txt文件
7、文件提交
git commit –m “这里是提交的备注”
8、推送更改到远程
git push
9、合并两个分支,比如 A 合并 B,先切换到分支 A,然后
git merge B
10、查看分支列表
git branch –a
这个可能和远程分支不一致,可以用上面提过的 git fetch 进行更新
11、合并其它分支的某个文件到当前分支
git checkout <branch> <filename> <filename>
12、查看某个文件提交记录
git log <file>
13、处理冲突
git stash
git pull
git stash pop