4 ms·
If you found a similar mistake in your repository, you can delete commit from history using: `git rebase --onto <commit-id>^ <commit-id>`. Or if you want actual
by LeonidBugaev 10y ago
If you found a similar mistake in your repository, you can delete commit from history using: `git rebase --onto <commit-id>^ <commit-id>`. Or if you want actually rewrite it, see git rebase -i` documentation.
- danieldk 10y agoDoesn't that requires a force push? Force pushes are acceptable for private repositories with a single user, but typically not in larger projects. Just revoke the password/secret/whatever.
- adrianN 10y agoOr do both? Better safe than sorry.
- jomkr 10y agoIt's better to just revoke and not re-write git history in a public repository. Re-writing history is pointless after the credentials are revoked, and causes a headache to others using your repository.
- majewsky 10y agoI find force pushes acceptable for topic branches of public repos. In fact, I use them a lot to leave behind clean history. Same as with squash merges, which technically also lose history.
- prodigal_erik 10y agoIt's better to push a similar name and let people decide if and when to rebase --onto the new upstream. Squash merges are just bad. They destroy all the info that makes git handle branching and conflicts better than svn.
- avip 10y agoYou'll have to revoke committed credentials regardless, as github is so frequently scrapped to find such content.
- Xylakant 10y agoA single person who checked out your repo before the force push will still have the credentials. Once this has been pushed to a public repo, assume that the credentials are burned and revoke them.
- Piskvorrr 10y agoIndeed; but these actions complement each other.
- Xylakant 10y agoif you revoke the credentials, removing them from the git history serves no purpose but disrupts everybody that has a clone of the repo. So you're doing harm for little benefit other than covering up the incident. A net loss, if you ask me.
- Mithaldu 10y agoIt serves the purpose of removing a hint on your password patterns from public availability. E: Oh, and just to preempt this, even saying "i use only random passwords with no pattern" is useful information, as is having a ballpark password length.
- thenickdude 10y agoDon't have password patterns, problem solved. Knowing that my password is 20 random characters of all possible symbols will not reduce your search space by any significant amount.
- Mithaldu 10y agoStill useful, means there's no point in checking any < 20, which halves the search space. Or, on the outside, can be useful to abort any attempts at bruteforce by way of cost evaluation and move on to another target.
- exDM69 10y ago`git filter-branch` is a tool intended to remove sensitive material from git history. It requires a force push, of course. If the keys/passwords are already pushed to GitHub or other public hostin, they should also be revoked.
- aargh_aargh 10y agoJust a tiny tweak - a handy shortcut to <commit-id>^ <commit-id> is <commit-id>^! I use it all the time with: git diff <commit-id>^!