Last active
December 3, 2017 18:25
-
-
Save tianhuil/a6675835a7a0c157fbcb296a743f52d4 to your computer and use it in GitHub Desktop.
Finds branches that can be safely merged
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
#!ipython | |
# to use this run these two steps | |
# curl https://gist.githubusercontent.com/tianhuil/a6675835a7a0c157fbcb296a743f52d4/raw/704a20201dd4362928f6e39ab0ab0bc0784b2af9/update_branches.ipy | |
# ipython merged_branches.ipy | |
!git checkout master | |
branches = !git branch | |
other_branches = [b.lstrip() for b in branches if b != '* master'] | |
results = {} | |
for branch in other_branches: | |
!git checkout {branch} | |
r = !git rebase master | |
r_str = ''.join(r) | |
if 'CONFLICT' in r_str: | |
!git rebase --abort | |
else: | |
d = !git diff {branch} master | |
if len(d) == 0: | |
!echo "Can delete {branch}" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment