Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@dashohoxha
Created February 25, 2018 12:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dashohoxha/8fe4b429e853fe82f4a17d185008bb74 to your computer and use it in GitHub Desktop.
Save dashohoxha/8fe4b429e853fe82f4a17d185008bb74 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