如何确定git中的最后一个合并分支?

时间:2015-09-01 03:16:52

标签: git bash merge

我需要确定哪个是最后一个合并为master的分支。

我一直在搜索git文档,但我仍然有点迷失。到目前为止,我已经找到了命令(假设master是我当前的分支)

git log --oneline --graph --decorate

这为我提供了这样的输出

git log --oneline --graph --decorate
*   12cfc6d (HEAD, origin/master, origin/HEAD, master) Merge branch 'release/VCS_6.12.0-20150826' to master
|\  
| *   bef8908 (origin/release/VCS_6.12.0-20150826) Merge remote-tracking branch 'origin/release/VCS_6.12.0-20150826' into release/VCS_6.12.0-20150826
| |\  
| | *   c61f97b Merge pull request #12 in COM/vcs from feature/SWAT-47-Loader-JMS to release/VCS_6.12.0-20150826
| | |\  
| | | *   33aefe6 (origin/feature/SWAT-47-Loader-JMS) [SWAT-47] Merge from release/VCS_6.12.0-20150826 branch
| | | |\  
| | | |/  
| | |/|   
| | * | 8f452b0 Revert pom.xml and fix formatting.
| | * | 128b347 Modified pom.xml by git hook. Command was mvn ci-versions:reset -DforceVersion=feature/VCS-4590_Migrate_translation_util_features
| | * | eaa9065 VCS-4590 - Migrate dev.vcs translation util to VCS production
| | | * 6fe1adc [SWAT-47] Move jmsProductUpdateListener bean to publishState-common-meta and properties config to appconfig.
| | | * ec8311f [SWAT-47] Revert the change of skipping role check for local testing
| | | * e545332 [SWAT-47] Fix checkstyle issues
| | | *   0df27b4 Merge remote-tracking branch 'origin/feature/SWAT-47-Loader-JMS' into feature/SWAT-47-Loader-JMS
| | | |\  
| | | | * cb87d1b Play with JMS
| | | * | 5f55b97 [SWAT-47] Added jmsProductUpdateListener to publish JMS message to jmsProductUpdate topic instead of jmsCacheReset topic.
| | | * | 09f1bc9 [SWAT-47] Play with JMS
| | | |/  

在那里你可以看到合并的最后一个分支是" origin / release / VCS_6.12.0-20150826"。

有一种更简单的方法可以用一个(或几个)bash命令来确定这个吗?

1 个答案:

答案 0 :(得分:7)

git log --first-parent --merges -1 --oneline

应该这样做。