3 ms·
What would happen if you: 1. checkout the last commit before the bad one. 2. cherry-pick every commit after the bad one. Would that get rid of the bad commit
by TekMol 8y ago
What would happen if you:
1. checkout the last commit before the bad one.
2. cherry-pick every commit after the bad one.
Would that get rid of the bad commit?
- jperry 8y agoYes, but it's a lot less painful to git rebase and skip that one commit (assuming there's nothing else in that commit you might need) or git-filter-branch like he said. All of these require you to fix everyone's local copy though.
- rzzzt 8y agoInteractive rebase allows you to do that (it will list all affected commits in the editor, you can remove the line corresponding to the bad commit, and by default it picks all other ones to the rebased branch): https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History#_changing_multiple https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History#_...
- WorldMaker 8y agogit filter-branch and BFG are faster/easier than an interactive rebase for this particular problem. The author wants to avoid rebases because they cannot "stop the world" on the project and have around 350 developers they can't tell to stop working while the rebase effort is done, and then rebase all their current work on top of the new branch history.