git常用命令

克隆一个全新的项目,完成新功能并且提交:
1、git clone XXX //克隆代码库
2、git checkout -b test //新建分支
3、modify some files //完成修改
4、git add . //把修改加入stage中
5、git commit -m '' //提交修改到test分支
6、review代码
7、git checkout master //切换到master分支
8、git pull //更新代码
9、git checkout test //切换到test分支
10、git meger master //把master分支的代码merge到test分支
11、git push origin 分支名//把test分支的代码push到远程库
正在test分支上面开发某个功能,但是没有完成。突然一个紧急的bug需要处理
1、git add .
2、git stash
3、git checkout bugFixBranch
4、git pull --rebase origin master
5、fix the bug
6、git add .
7、git commit -m ''
8、git push
9、git checkout test
10、git stash pop
11、continue new feature's development

以上为总结参考记录。
网友评论