Git命令查找哪些分支合并到当前分支以及何时 [英] Git command to find what branches were merged into current branch and when

查看:287
本文介绍了Git命令查找哪些分支合并到当前分支以及何时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个功能分支被自动合并到集成分支中。我想知道是否以及何时发生。



我可以键入 git log ,它会告诉我发生了合并,但由于某种原因,它不显示我从哪个功能分支,它只是说合并integration_branch到integration_branch

我可以输入 git branch --merged

但只列出要合并到集成分支中的功能分支。我想知道何时何人,并能够深入了解这一合并信息。

解决方案

我会利用 git log 这:

  git log --graph --full-history --all --color \ 
- pretty = format:%x1b [31m%h%x09%x1b [32m%d%x1b [0m%x20%s

这会着色每个分支和合并。它还会标记每个分支的头部。



您可以添加相对日期和提交者名称:

  git log --graph --full-history --all --color \ 
--pretty = format:%x1b [31m%h%x09%x1b [ 32m%d%x1b [0m%x20%s \
%Cgreen(%cr)%C(粗体蓝色)<%an>%Creset'

更多信息请参阅: http://git-scm.com/book/en/Git-Basics-Viewing-the-Commit-History


I have several feature branches that are being automatically merged into the integration branch. I'd like to know if and when this is happening.

I can type git log which will show me that a merge has happened but for some reason it does not show me from which feature branch it just says "merged integration_branch into integration_branch"

I can type git branch --merged

but that only lists the feature branches that are being merged into the integration branch. I'd like to know when and by whom, and be able to drill down into this merge information.

解决方案

I would make use of git log with some colours to do this:

git log --graph --full-history --all --color \ 
--pretty=format:"%x1b[31m%h%x09%x1b[32m%d%x1b[0m%x20%s"

This will colour each branch and the merges. It will also label the head of each branch.

You can add relative dates and committer names with this:

git log --graph --full-history --all --color \
--pretty=format:"%x1b[31m%h%x09%x1b[32m%d%x1b[0m%x20%s \
%Cgreen(%cr) %C(bold blue)<%an>%Creset'"

For more info see: http://git-scm.com/book/en/Git-Basics-Viewing-the-Commit-History

这篇关于Git命令查找哪些分支合并到当前分支以及何时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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