On a commit I accidentally included a password. How do I remove this commit from the repository?
The push went to github so It's important that the commit be removed completely from the history.
On a commit I accidentally included a password. How do I remove this commit from the repository?
The push went to github so It's important that the commit be removed completely from the history.
You should do as follow:
git log --oneline -S <COMMIT_SEARCH_PATTERN>
# Copy the commit hash
git rebase - i <COMMIT_HASH>~1
# Change the marker to **drop**
# Exit from the editor
git rebase --continue
git push --force
To remove the password for future clones and fetches, I'd point you to git rebase
, editing the commit and then doing a git push --force
.
Of course - you have to change the password anyways.