Last active
September 22, 2017 23:39
-
-
Save jameswilson/7d692b0dc5930a2c38d89c99f32dfb36 to your computer and use it in GitHub Desktop.
Git list merged branches in one branch, but not on another
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Git command to compare which branches are merged into one branch but not | |
# present in another. Useful for comparing which branches have been merged | |
# into a release branch that are already on the mainline branch. | |
# | |
# Usage: | |
# | |
# git mdiff origin/master origin/integration | |
# | |
# - Reveals a list of remote branches that are present on integration but | |
# not on master. | |
# | |
# | |
# See https://stackoverflow.com/questions/8071079 for a nice situational | |
# diagram to explain the typical use case. | |
# | |
# The following command does not work as a git alias because it depends on | |
# Process Substitution <(..) and does not work with /bin/sh which is what | |
# git uses to process aliases. | |
# | |
comm -12 <(sort <(git branch -r --no-merged $1 )) <(sort <(git branch -r --merged $2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment