I'd like to automate cleaning of remote branches. I want to be able to check to see if a branch has been merged into master already. Originally, my plan was to use git merge-base to see the last common commit.
However, it turns out that we squash all of our branches as we merge them into master. As this creates a new commit hash, I'm unable to find the common commits between master and my branches.
How might I go about determining if a branch has been merged if we've squashed them all when merging?
Thanks in advance!
You could do an experimental merge and check whether it introduces any changes, like so:
This will only work if none of the files changed in the original
git merge --squash foo
have seen further conflicting changes onmaster
since then.