Skip to content

Instantly share code, notes, and snippets.

@npasserini
Last active May 11, 2018 03:15
Show Gist options
  • Select an option

  • Save npasserini/05c1363dc6a99c8b2d53192d64245afb to your computer and use it in GitHub Desktop.

Select an option

Save npasserini/05c1363dc6a99c8b2d53192d64245afb to your computer and use it in GitHub Desktop.
Rebase a sequence of connected branches, each one depending on the previous one.
# This is useful for repositories holding several stages of a same example, as some teachers do for their class examples.
# This strategy is useful for showing different steps of the construction of a piece of software.
# The problem is that if you have to change something in one of the initial branches, you have to rebase all following ones.
# This script can help automate that process.
# In my case the initial branch is named `inicioClaseHerencia`
# And all dependent branches are named `punto1-...` to `punto#-...`, so they can be find with a pattern.
old=inicioClaseHerencia
for b in `gb --list "punto*"`; do
gco $b;
git rebase $old
old=$b
done
git push --all -f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment