Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 44 lines (37 sloc) 1.149 kb
#!/bin/sh
# Reapplies the stacked branch architecture:
# master => other => patch => minor => major
# abort if any shell commands fail
set -e
# ensure that working tree is clean
git rebase HEAD --quiet
git branch -v # for user's reference
# reapply stacked branch architecture
original=$(git name-rev --name-only HEAD)
previous=
for branch in master other patch minor major; do
if [ -n "$previous" ]; then
echo; echo; echo;
# checkout or create the branch as needed
if [ -n "$(git branch --list $branch)" ]; then
git checkout $branch
else
git checkout $branch ||
git checkout -b $branch $previous
fi
# stack this branch atop the previous one
commit=$(git rev-parse --short HEAD)
if ! git rebase --preserve-merges $previous --quiet >/dev/null 2>&1; then
while [ -d .git/rebase-apply ]; do
echo -n 'Skipping conflicting commit: '
cat .git/rebase-apply/original-commit
git rebase --skip
done
# show differences if conflicting
git --no-pager diff
fi
fi
previous=$branch
done
# put user back at their original branch
git checkout $original
Jump to Line
Something went wrong with that request. Please try again.