Created
July 1, 2016 20:51
-
-
Save IanVaughan/b4efae345a7bd8cfac1c27b0cbc1de69 to your computer and use it in GitHub Desktop.
Bash script to show branches merged into a branch
This file contains 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/sh | |
# Bash script to show branches merged into a branch | |
# Place within your $PATH | |
# Usage : staging-branches | |
# Finds all merged branches since master and lists them out | |
master_sha=$(git show-ref origin/master -s) | |
merged_branches=$(git log $master_sha.. --format="%s" | grep Merge) | |
printf '%s\n' "${merged_branches[@]}" | cut -d " " -f3- | cut -d ' ' -f 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment