Skip to content

Instantly share code, notes, and snippets.

@Ethan-code
Forked from framon/rebase_first_commit.sh
Created October 13, 2017 06:57
Show Gist options
  • Save Ethan-code/7ae5bcc2494b32320327fa54cee6f9ea to your computer and use it in GitHub Desktop.
Save Ethan-code/7ae5bcc2494b32320327fa54cee6f9ea to your computer and use it in GitHub Desktop.
Insert commit as first, allowing rebase of initial commit
# first you need a new empty branch; let's call it `newroot`
git checkout --orphan newroot
git rm -rf .
# then you apply the same steps
git commit --allow-empty -m 'root commit'
git rebase --onto newroot --root master
git branch -d newroot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment