日常git命令

#### 合并分支:
1丶合并前把develop分支rebase/merge到feature分支,自测后,再发合并请求。
这样做主要是考虑到: `feature分支合并到develop分支后,可能会出现冲突,把冲突在feature分支解决,尽量减少feature合并到develop分支后的冲突。其他考虑点暂时没想到......`

2、
git pull的默认行为是git fetch + git merge,
git pull --rebase则是git fetch + git rebase.

git rebase --abort 会回到rebase操作之前的状态,之前的提交的不会丢弃;
git rebase --skip 则会将引起冲突的commits丢弃掉;
git rebase --continue 用于修复冲突,提示开发者,一步一步地有没有解决冲突,fix conflicts and then run "git rebase --continue"

3、基于develop分支建立feature分支
- 第一步.在分支develop,拉取最新代码
git pull
- 第二步.查看分支
git branch
- 第三步.建立feature分支
git branch feature_1234
- 第四步.推送feature分支到远程
git push origin feature_1234:feature_1234
- 第五步.查看所有分支
git branch -a

4、合并分支feature到develop

5、
git remote prune origin
删除本地有但在远程库已经不存在的分支

[在MSys版的Git中使用git pull --rebase进行代码更新到底是做了什么?](https://www.zhihu.com/question/23586864)

posted @ 2017-12-26 23:42  求知若渴,虚怀若愚  阅读(141)  评论(0编辑  收藏  举报
原来是这样!我和我的小伙伴都惊呆了!