Created
December 30, 2009 21:21
-
-
Save shahn/266402 to your computer and use it in GitHub Desktop.
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/bash | |
mkdir testtmp | |
cd testtmp | |
git init | |
echo A>A | |
git add A | |
git commit -m "A" | |
echo B>B | |
git add B | |
git commit -m "B" | |
git checkout -b branch1 | |
echo C>C | |
git add C | |
git commit -m "C" | |
git checkout master | |
echo D>D | |
git add D | |
git commit -m "D" | |
echo E>E | |
git add E | |
git commit -m "E" | |
git checkout -b branch2 | |
echo F>F | |
git add F | |
git commit -m "F" | |
git checkout master | |
echo G>G | |
git add G | |
git commit -m "G" | |
#verify that this is what you want with gitk --all | |
git checkout -b tmp branch2 | |
git rebase --onto branch1 `git merge-base master branch2` | |
git checkout branch1 | |
git reset --hard tmp | |
git branch -d tmp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment