Last active
June 3, 2021 20:24
-
-
Save michaeloyer/ad89832e4ed61ab6d5337cce0bd66ba3 to your computer and use it in GitHub Desktop.
Git Rebase Onto explained with a script you can run on an empty directory
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
git init | |
git checkout -b original | |
git commit --allow-empty -m 'Commit 1' | |
git commit --allow-empty -m 'Commit 2' | |
git commit --allow-empty -m 'Commit 3 (third)' | |
git tag third | |
git commit --allow-empty -m 'Commit 4' | |
git commit --allow-empty -m 'Commit 5' | |
git tag fifth | |
git commit --allow-empty -m 'Commit 6 (sixth)' | |
git commit --allow-empty -m 'Commit 7' | |
git commit --allow-empty -m 'Commit 8' | |
git checkout -b rebased | |
git commit --allow-empty -m 'Test Commit 1' | |
git commit --allow-empty -m 'Test Commit 2' | |
git commit --allow-empty -m 'Test Commit 3' | |
git rebase --onto third fifth | |
git log --format='%C(bold blue)%s' original | |
git log --format='%C(bold yellow)%s' rebased |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment