Git command to find what branches were merged into current branch and when

你离开我真会死。 提交于 2020-01-13 09:46:09

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/14205561/git-command-to-find-what-branches-were-merged-into-current-branch-and-when

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!