Skip to content

Instantly share code, notes, and snippets.

@clm-a
Created March 10, 2012 10:08
Show Gist options
  • Save clm-a/2011024 to your computer and use it in GitHub Desktop.
Save clm-a/2011024 to your computer and use it in GitHub Desktop.
Insert a blank root commit on an existing repo
# from http://stackoverflow.com/a/647451
git symbolic-ref HEAD refs/heads/newroot
git rm --cached -r .
git clean -f -d
# then you apply the same steps
git commit --allow-empty -m 'root commit'
git cherry-pick $(git rev-list --reverse master | head -1)
git rebase --onto newroot newroot master
git branch -d newroot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment