Skip to content

Instantly share code, notes, and snippets.

@sreelallalu
Created August 8, 2018 06:17
Show Gist options
  • Save sreelallalu/d9579eb4bfe0e69656b4eee62a45c361 to your computer and use it in GitHub Desktop.
Save sreelallalu/d9579eb4bfe0e69656b4eee62a45c361 to your computer and use it in GitHub Desktop.
Git remove old commits
git checkout --orphan TEMP_BRANCH
# Add all the files:
git add -A
# Commit the changes:
git commit -am "Initial commit"
# Delete the old branch:
git branch -D master
# Rename the temporary branch to master:
git branch -m master
# Finally, force update to our repository:
git push -f origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment