Jes*_*sse 56
假设您的合并提交是ab2f8173,git log ab2f8173^..ab2f8173将显示它合并的提交.
以下是如何将其转换为git别名以便于重复使用:
$ git config --global alias.merge-log '!f() { git log --stat "$1^..$1"; }; f'
$ git merge-log 0865c12
Run Code Online (Sandbox Code Playgroud)
Col*_*ert 40
如果要查看上次合并中合并的每个提交,可以尝试:
git log $(git merge-base --octopus $(git log -1 --merges --pretty=format:%P)).. --boundary
Run Code Online (Sandbox Code Playgroud)
这是我当前日志的一个示例:
$ git log --graph --pretty=oneline --abbrev-commit
* 44899b9 pouf
* 8f49f9c Merge branch 'test'
|\
| * 3db39ca test
* | 69f431c pif
* | df1f51c lala
|/
* 8fae178 pif2
* 20f8ba6 init
Run Code Online (Sandbox Code Playgroud)
如果我只想要与上一次合并相关的提交,我必须使用git log -1 --merges --pretty=format:%P它,这给了我第一次合并的父母:
$ git log -1 --merges --pretty=format:%P
69f431cec7859b61d33c7503c9431ceea2aaf3e0 3db39ca3ab1e8f70462db23d94590628b5e7ad7b
Run Code Online (Sandbox Code Playgroud)
现在我知道我需要跟踪哪些父母,我需要他们可以通过他们获得的共同基础git merge-base --octopus( - 以及以防万一):
$ git merge-base --octopus $(git log -1 --merges --pretty=format:%P)
8fae178666e34a480b22e40f858efd9e7c66c3ca
Run Code Online (Sandbox Code Playgroud)
现在git log我可以搜索从基础到当前HEAD的所有提交和voilà:
$ git log $(git merge-base --octopus $(git log -1 --merges --pretty=format:%P)).. --boundary --graph --pretty=oneline --abbrev-commit
* 44899b9 pouf
* 8f49f9c Merge branch 'test'
|\
| * 3db39ca test
* | 69f431c pif
* | df1f51c lala
|/
o 8fae178 pif2
Run Code Online (Sandbox Code Playgroud)
如果你有点完美主义者,你也可以这样做:
$ git log $(git merge-base --octopus $(git log -1 --merges --pretty=format:%P))..$(git log -1 --merges --pretty=format:%H) --boundary --graph --pretty=oneline --abbrev-commit
* 8f49f9c Merge branch 'test'
|\
| * 3db39ca test
* | 69f431c pif
* | df1f51c lala
|/
o 8fae178 pif2
Run Code Online (Sandbox Code Playgroud)
现在我想我会把它作为别名:)
PS:显然你不必保留--graph --pretty=oneline --abbrev-commit选项
资源:
| 归档时间: |
|
| 查看次数: |
22923 次 |
| 最近记录: |