Skip to content

Instantly share code, notes, and snippets.

@rodrigocnascimento
Created July 26, 2017 04:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rodrigocnascimento/90a2c577c46980e4809f7012c04e2b6f to your computer and use it in GitHub Desktop.
Save rodrigocnascimento/90a2c577c46980e4809f7012c04e2b6f to your computer and use it in GitHub Desktop.
git.tip

If you want to delete all your commit history but keep the code in its current state it is very safe to do it as in the following:

Checkout

git checkout --orphan latest_branch

Add all the files

git add -A

Commit the changes

git commit -am "commit message"

Delete the branch

git branch -D master

Rename the current branch to master

git branch -m master

Finally, force update your repository

git push -f origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment