「Git」merge –squash介绍
来源:互联网 发布:怎样破解公司网络限制 编辑:程序博客网 时间:2024/05/31 18:30
Git相对于CVS和SVN的一大好处就是merge非常方便,只要指出branch的名字就好了,如:
$ git merge another$ git checkout another# modify, commit, modify, commit ...$ git checkout master$ git merge another
但是,操作方便并不意味着这样操作就是合理的,在某些情况下,我们应该优先选择使用–squash选项,如下:
$ git merge --squash another$ git commit -m "message here"
–squash选项的含义是:本地文件内容与不使用该选项的合并结果相同,但是不提交、不移动HEAD,因此需要一条额外的commit命令。其效果相当于将another分支上的多个commit合并成一个,放在当前分支上,原来的commit历史则没有拿过来。
判断是否使用–squash选项最根本的标准是,待合并分支上的历史是否有意义。
如果在开发分支上提交非常随意,甚至写成微博体,那么一定要使用–squash选项。版本历史记录的应该是代码的发展,而不是开发者在编码时的活动。
只有在开发分支上每个commit都有其独自存在的意义,并且能够编译通过的情况下(能够通过测试就更完美了),才应该选择缺省的合并方式来保留commit历史。
阅读全文
0 0
- 「Git」merge –squash介绍
- git merge –squash介绍
- git merge --squash的用法
- 聊下git merge --squash
- git merge --squash改写提交
- git merge之squash merge 看日志
- git学习六(git merge --squash)
- git merge的参数--squash的用处
- git merge fast-forward squash no-ff
- --no-ff是什么意思?? 和 git merge --squash 有什么区别???
- Squash Commits with Git
- 从 git rebase squash 恢复
- Git 操作之rebase、squash
- git merge的一些介绍
- git -no-ff && --squash && fast-forward
- git merge 工具 gvimdiff使用介绍
- git stash提交PR的正确步骤&git squash技术
- git merge
- 「Git」合并多个 Commit
- JSP自定义标签开发入门(转)
- 「Git」submodule使用入门
- SourceTree 免登录跳过初始设置
- .gitignore忽略了文件,每次提交还是会变更这个文件的解决方法
- 「Git」merge –squash介绍
- 微信网页开发weixin://preInjectJSBridge/fail、分享描述失效问题记录
- java中分代思想
- The repository for this project is empty 解决方法
- spring_SSH整合之_Struts2_Spring_Plugin的详解
- CSS中margin和padding的区别
- append和appendTo的使用方法
- [leetcode]: 598. Range Addition II
- 解决ubuntu apt-get install出现E:Clould not get lock /var/lib/dpkg/lock