This is very similar to How can I know in git if a branch has been already merged into master? but is about checking for rebased code. In the repository I am currently working on it seems that a few feature branches have been left hanging aground after their changes were rebased onto master. What is the best way for me to check that this has been done before I delete the branch?
Most of the suggestions on that branch suggest using the SHA id key of the last change on a branch to check for its presence in master. I can see that is the best way to be sure for merging but when you rebase this SHA is changed.
I have an answer that I will post too but I would like to know if people think there are better options.
In a case where the rebases are faithful to the original commit message @TafT's answer will work well. In addition, using
git log --oneline --cherry master...some-branch
will show =
by every commit that has been copied exactly the same from some-branch to master.
If squashing and the like is taking place, commit messages are changed, or if your rebasing had conflicts neither solution will work. In this case I suggest the following (Checkout to detached HEAD so that we do not accidentally push this merge):
git checkout master~0
git merge some-branch
Unless your code has changed drastically, if the merge results in no change, then the branch has been rebased already. Otherwise, it obviously has not.