如何确定git中的最后一个合并分支? [英] How to determine last merged branch in git?

查看:96
本文介绍了如何确定git中的最后一个合并分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



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

  git log --oneline --graph --decorate 

这为我提供了这样的输出

  git log --oneline --graph --decorate 
* 12cfc6d(HEAD,origin / master,origin / HEAD,master)合并分支'release / VCS_6.12.0-20150826 '掌握
| \
| * bef8908(origin / release / VCS_6.12.0-20150826)合并远程追踪分支'origin / release / VCS_6.12.0-20150826'到release / VCS_6.12.0-20150826
| | \
| | * c61f97b从功能/ SWAT-47-Loader-JMS的COM / vcs中合并请求#12以释放/ VCS_6.12.0-20150826
| | | \
| | | * 33aefe6(原产地/功能/ SWAT-47-Loader-JMS)[SWAT-47]从版本合并/ VCS_6.12.0-20150826分支
| | | | \
| | | | /
| | | / |
| | * | 8f452b0恢复pom.xml并修复格式。
| | * | 128b347通过git hook修改pom.xml。命令是mvn ci-versions:reset -DforceVersion = feature / VCS-4590_Migrate_translation_util_features
| | * | eaa9065 VCS-4590 - 将dev.vcs翻译工具迁移到VCS制作
| | | * 6fe1adc [SWAT-47]将jmsProductUpdateListener bean移动到publishState-common-meta和properties config到appconfig。
| | | * ec8311f [SWAT-47]恢复本地测试
|的跳过角色检查的更改| | * e545332 [SWAT-47]修复checkstyle问题
| | | * 0df27b4合并远程追踪分支'起源/特征/ SWAT-47-Loader-JMS'到特征/ SWAT-47-Loader-JMS
| | | | \
| | | | * cb87d1b使用JMS
|进行游戏| | * | 5f55b97 [SWAT-47]添加了jmsProductUpdateListener以将JMS消息发布到jmsProductUpdate主题,而不是jmsCacheReset主题。
| | | * | 09f1bc9 [SWAT-47]玩JMS
| | | | /

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



是否有一种更简单的方法来确定这个命令是否包含一个或多个bash命令?

解决方案

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

应该这样做。


I need to determine which was the last branch merged into master.

I have been searching around the git docs but I am still a bit lost. So far I have found the command (assuming master is my current branch)

git log --oneline --graph --decorate

Which provides me an output like this

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
| | | |/  

There you can see that the last branch merged was "origin/release/VCS_6.12.0-20150826".

Is there a simpler way to determine this with one (or several) bash commands?

解决方案

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

should do it.

这篇关于如何确定git中的最后一个合并分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆