[英]Git: Merge in branch without polluting the Master history
好的:
在svn和bzr中,我可以分支,提交,合并,我的提交历史记录将如下所示:
41: Theodore R. Smith 2013-09-14 Jump to list by name instead of number.
40: Theodore R. Smith 2013-09-14 [merge] [m] Miscellaneous cleanups.
39.1.4: Theodore R. Smith 2013-09-14 [m] Removed old files.
39.1.3: Theodore R. Smith 2013-09-14 [m] Fixed bug where test could not...
39.1.2: Theodore R. Smith 2013-09-14 [m] Fixed a CSS layout bug from th...
39.1.1: Theodore R. Smith 2013-09-14 [m] Fixed a typo.
39: Theodore R. Smith 2013-09-14 Added a progress bar.
38: Theodore R. Smith 2013-09-14 [merge] Updated the core libraries.
37.1.3: Theodore R. Smith 2013-09-14 Updated HTML Kickstarter.
37.1.2: Theodore R. Smith 2013-09-14 Upgraded to from jQuery 1.8.3 to 2.0.3.
37.1.1: Theodore R. Smith 2013-09-14 Upgraded to jQuery Address v1.6.
如果我不想扩展历史,我可以:
41: Theodore R. Smith 2013-09-14 Jump to list by name instead of number.
40: Theodore R. Smith 2013-09-14 [merge] [m] Miscellaneous cleanups.
39: Theodore R. Smith 2013-09-14 Added a progress bar.
38: Theodore R. Smith 2013-09-14 [merge] Updated the core libraries.
在任何时候,我可以得到的diff等,为个体合并承诺很容易,通过bzr diff -r37.1.2..37.1.3
,例如。
重要的是保留了我的分支历史记录,并且我的主线提交历史记录不受次要功能提交的污染。
现在,每当我在git中进行功能合并时,无论是否使用--no-ff
,我在提交历史记录中都会得到以下内容:
<hash>: Theodore R. Smith 2013-09-14 Jump to list by name instead of number.
<hash>: Theodore R. Smith 2013-09-14 [merge] [m] Miscellaneous cleanups.
<hash>: Theodore R. Smith 2013-09-14 [m] Removed old files.
<hash>: Theodore R. Smith 2013-09-14 Added a progress bar.
<hash>: Theodore R. Smith 2013-09-14 [m] Fixed bug where test could not...
<hash>: Theodore R. Smith 2013-09-14 [merge] Updated the core libraries.
<hash>: Theodore R. Smith 2013-09-14 [m] Fixed a CSS layout bug from th...
<hash>: Theodore R. Smith 2013-09-14 Updated HTML Kickstarter.
<hash>: Theodore R. Smith 2013-09-14 [m] Fixed a typo.
<hash>: Theodore R. Smith 2013-09-14 Upgraded to from jQuery 1.8.3 to 2.0.3.
<hash>: Theodore R. Smith 2013-09-14 Upgraded to jQuery Address v1.6.
我的问题很多。
我想要一个解决方案
git rebase
是git merge --squash
,就像git merge --squash
。 git log
。 感谢您帮助我理解这个过于复杂的程序!
Git和Bazaar的图形完全相同,我知道因为我编写了Git的官方Bazaar桥,唯一的区别是图形是如何通过log
命令呈现的。
git log
有很多选项,因此可以准确指定您希望如何呈现该图形。
看起来你想要的是这个:
git log --oneline --graph
这将以与bzr log
类似的方式向您显示合并:
* eaaec50 Merge git://github.com/git-l10n/git-po
|\
| * 1b5f46f l10n: Add reference for french translation team
| * 6b388fc l10n: fr.po: 821/2112 messages translated
* | 2809258 Merge branch 'sb/mailmap-updates'
|\ \
| * | cdb6b5a .mailmap: Combine more (name, email) to individual persons
| * | 10813e0 .mailmap: update long-lost friends with multiple defunct addresses
* | | 8ed205a git-remote-mediawiki: ignore generated git-mw
| |/
|/|
* | 96cb27a Merge branch 'maint'
您也可以完全忽略“次要提交”
git log --oneline --first-parent
eaaec50 Merge git://github.com/git-l10n/git-po
2809258 Merge branch 'sb/mailmap-updates'
8ed205a git-remote-mediawiki: ignore generated git-mw
96cb27a Merge branch 'maint'
如果您厌倦了键入所有这些选项,则可以配置别名:
git config --global alias.l 'log --oneline --graph'
所以你可以输入git l
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.