Reputation: 824
If I have a feature branch F and master branch M, then
git branch --merged
while on master will show me if F has been entirely merged into M, but how can I tell if it has EVER been merged?
I've tried looking through the git-log manual and from what I can tell
git log M..F
will show me the revs on F that haven't been merged into M. I'd like to see the inverse of that, the revs on F that have been merged into M.
There are a whole bunch of questions which are close to this but don't seem to cover this particular case.2
Upvotes: 11
Views: 6503
Reputation: 17117
Use git log
:
git log feature_branch master --oneline --date-order --merges --reverse -1
This will show you all merges betwee feature_branch and master. --reverse
will output the commits in reverse order. And -1
means to show only one
commit. Therefore you'll see only the first merged commit.
If this is an empty output than it means nothing is merged. If you want you can remove the -1
at the end to show all merged commits beginning with the latest.
Upvotes: 6
Reputation: 15896
1. lists the branches that are already merged
git branch --merged
2. lists the branches that have not been merged (if its not there that means its merged)
git branch --no-merged
Upvotes: 4