2

I have featurue branches that I squash before merging into the integration branch. Sometimes I have random feature branches lying around and I cannot remember if they were merged into the integration branch.

The problem, is that if I run git merge to check, sometimes this will cause problems for feature branches that have already been merged + squashed into the integration branch. (If someone can explain exactly what this problem is, that would be nice, I assume it's because the squash and merge creates an extra commit).

So how can I check if a branch has already been merged without running git merge?

Alexander Mills
  • 90,741
  • 139
  • 482
  • 817

1 Answers1

2

You can check the diff of your branch against the integration branch. If it is already merged there will be no changes.

https://stackoverflow.com/a/17618008/498699

You can use ... to only show the changes on one branch as compared to the other.

So your command would be git diff <integration branch>...<feature branch>. If the diff is empty then the branches were merged together otherwise they weren't.

Schleis
  • 41,516
  • 7
  • 68
  • 87