我要在头前显示所有的提交,并显示每个提交的所有分支引用。
git log --graph --decorate --oneline --all
结果:
* 48879e9 (HEAD -> testlog) test git branch
| * 5b197c5 (master) test amend before commit is eighth commit
| * 57484e1 eighth commit
| * 90f8daa seventh commit
| * 185410d sixth commit
| * 90864ad sixth commit
| * 5ce7d48 fourth commit
|/
* d0e380b third commit
* def8327 second commit
* 6413042 first commit现在我在承诺‘48879 e9’
I型:git log --graph --abbrev-commit --decorate testlog
结果:
* commit 48879e9 (testlog)
| Author: 中文姓名 <chinalilonglong@sina.com>
| Date: Thu May 24 15:53:05 2018 +0800
|
| test git branch
|
* commit d0e380b
| Author: 中文姓名 <chinalilonglong@sina.com>
| Date: Fri May 18 11:29:11 2018 +0800
|
| third commit
|
* commit def8327
| Author: 中文姓名 <chinalilonglong@sina.com>
| Date: Fri May 18 11:28:36 2018 +0800
|
| second commit
|
* commit 6413042
Author: 中文姓名 <chinalilonglong@sina.com>
Date: Fri May 18 11:16:43 2018 +0800如何在当前头之前显示提交。
如何在括号中显示所有分支引用每个提交。
就像这样:
* commit 48879e9 (testlog)
| Author: 中文姓名 <chinalilonglong@sina.com>
| Date: Thu May 24 15:53:05 2018 +0800
|
| test git branch
|
* commit d0e380b (master)
| Author: 中文姓名 <chinalilonglong@sina.com>
| Date: Fri May 18 11:29:11 2018 +0800
|
| third commit
|
* commit def8327
| Author: 中文姓名 <chinalilonglong@sina.com>
| Date: Fri May 18 11:28:36 2018 +0800
|
| second commit
|
* commit 6413042
Author: 中文姓名 <chinalilonglong@sina.com>
Date: Fri May 18 11:16:43 2018 +0800我把* commit d0e380b改成了* commit d0e380b (master)。
通过这样做,我可以快速搜索当前分支的哪个分支。
发布于 2018-05-24 16:28:35
分支指针或多或少只是指向特定提交的指针。--decorate选项git log将将分支引用打印到分支引用的指定提交。
您的master分支引用指向5b197c5。因此,在为git log分支执行testlog时不会打印它,因为5b197c5不是testlog分支的一部分。
替代方法1
如果您只想在日志中看到testlog分支与主服务器分离,可以尝试执行:git log $(git merge-base master testlog)^..testlog --这将不会产生与您期望的结果相同的结果。但是,如果运行该命令,它将从两个分支之间最新的公共提交开始,在testlog分支上打印提交日志。(因此您知道,该命令打印的最后一次提交同时存在于testlog分支和master分支中)。
替代方法2
输出看起来会很不一样,但是您可以尝试使用git show-branch命令。示例(作为一幅图片,因为它更容易在眼睛上显示正确的颜色):

在这里,您可以看到branch3和master之间最新的常见提交是e828d00。branch1上的所有提交都存在于master分支中。729edd5是最新的提交,对于所有四个分支来说都是常见的。等。
但是,如果有太多的分支,输出可能会变得有点混乱。
https://stackoverflow.com/questions/50504391
复制相似问题