-
-
Save tommcfarlin/a22929625c320d985747a83de31c0618 to your computer and use it in GitHub Desktop.
[Source Control] Removing Git Commit History (Both Local and Remote)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First, review the history. (Gotta make sure you're going to roll back to the right place!) | |
$ git log --pretty=oneline --abbrev-commit | |
# Remove HEAD back to the commit prior to the one that has sensitive information | |
# and set equal to the last good commit. | |
$ git rebase -i HEAD~1 | |
# Push the content to the remote repository and remove it from the history. | |
$ git push origin +<name of branch> | |
# If you want to review the history... | |
$ git log --pretty=oneline --abbrev-commit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment