On Thu, May 2, 2013 at 12:15 PM, shawn wilson <ag4ve.us@xxxxxxxxx> wrote: > I've got a commit that was done about a week ago that I want to remove > (preferably remove and rewrite history as it's in a branch and it > doesn't need to be in this branch until the branch is working) but if > a reverse patch is the only way, i'll go with it. Whether or not you should rewrite history depends on whether the bad commit has been shared with anybody else. If others have started working on top of your history, they will not enjoy it if you rewrite that history and force them to rebase their work accordingly. In that case, your best bet is a reverse patch: "git revert $bad_commit_sha1" Otherwise, if the bad commit exists nowhere else but your own repo, then you can do an interactive rebase to remove the bad commit: On the branch with the bad commit: "git rebase -i $bad_commit_sha1^" (the trailing caret ^ is important). This will launch a text editor listing your last commits starting with your bad commit. Delete the first line containing your bad commit, and save/exit the editor. Git will now replay all your last commits except for the bad commit. If any of the later commits touch the same stuff as the bad commit did, Git might stop the rebase because of conflicts when it replays those patches. In this case, fix the conflicts, add the file, and "git rebase --continue". Repeat until all commits have been replayed and the rebase is finished. Hope this helps, ...Johan -- Johan Herland, <johan@xxxxxxxxxxx> www.herland.net -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html