Skip to content

Instantly share code, notes, and snippets.

@born2net
Created July 11, 2016 16:23
Show Gist options
  • Save born2net/0fe438c5851b4c01326d5bd99e043a58 to your computer and use it in GitHub Desktop.
Save born2net/0fe438c5851b4c01326d5bd99e043a58 to your computer and use it in GitHub Desktop.
git: recreate repository based on current files
cp .git/config /tmp/gitBackup
rm -rf .git
git init
cp /tmp/gitBackup .git/config
git remote add origin <url from 1st command>
git add .
git status
git commit -m "rewrite history"
git push -f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment