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.
You can use the git merge-base command to find the latest common commit between the two branches. If that commit is the same as your branch head, then the branch has been completely merged.
Merging Branches. Once you've completed work on your branch, it is time to merge it into the main branch. Merging takes your branch changes and implements them into the main branch. Depending on the commit history, Git performs merges two ways: fast-forward and three-way merge.
When you perform a merge, you effectively merge one branch into another—typically a feature branch or bug fix branch into a main branch such as master or develop. Not only will the code changes get merged in, but also all the commits that went into the feature branch.
You can have head branches automatically deleted after pull requests are merged in your repository. Anyone with admin permissions to a repository can enable or disable the automatic deletion of branches.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With