You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 25, 2022. It is now read-only.
I'd like a way to determine if a branch has been merged into another branch. I'm not sure that this has a lot of stand-alone use however I think it would be helpful in the context of more complex scripts.
The text was updated successfully, but these errors were encountered:
will give you a list of all branches that have been merged into your current branch.
Programmatically
While it is nice to be able to do this manually (and we could probably do some fancy grepping to get the answer), I think there is another approach.
git merge-base mybranch develop
Will give me the most recent common commit between mybranch and develop. If we compare this most recent commit on mybranch, if they are the same we'll know that develop is a superset of mybranch and thus mybranch has been merged into develop.
In other words, if
git merge-base mybranch develop
and
git rev-parse mybranch
return the same hash, then mybranch has been merged into develop
If there is no output then mybranch has no commits that do not appear in develop (i.e. it mybranch has been merged into develop), if there is any output then mybranch has commits NOT in develop (mybranch has no been merged into develop)
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I'd like a way to determine if a branch has been merged into another branch. I'm not sure that this has a lot of stand-alone use however I think it would be helpful in the context of more complex scripts.
The text was updated successfully, but these errors were encountered: