Skip to content

Instantly share code, notes, and snippets.

@mojtabacazi
Created November 29, 2016 21:09
Show Gist options
  • Save mojtabacazi/35828bf4141f6ea7454640b453067b61 to your computer and use it in GitHub Desktop.
Save mojtabacazi/35828bf4141f6ea7454640b453067b61 to your computer and use it in GitHub Desktop.
Inserting a commit before git 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