Skip to content

Instantly share code, notes, and snippets.

@temoto
Created July 10, 2014 09:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save temoto/e5922d1b5b299a9a5db2 to your computer and use it in GitHub Desktop.
Save temoto/e5922d1b5b299a9a5db2 to your computer and use it in GitHub Desktop.
Git rebase all branches onto origin/master
#!/bin/bash
set -e
onto=origin/master
git fetch --prune
git branch --remotes --list 'origin/*' |grep -vE 'HEAD|master|gh-pages' |cut -d/ -f2 |while read -r b; do
printf "\nRebasing $b\n\n"
git checkout -B $b origin/$b
git rebase $onto && continue
git rebase --abort
git reset
git checkout .
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment