Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Revisions

2 of 7
http://www.kernel.org/pub/software/scm/git/docs/git-rebase.html was remapped to http://git-scm.com/docs/git-rebase by Sam Saffron (17174)

If you have not yet pushed the commit anywhere, you can use git rebase -i to remove that commit. First, find out how far back that commit is (approximately). Then do:

git rebase -i HEAD~10

The ~10 means rebase the last 10 commits. Then, you can edit the file that Git presents to you to delete the offending commit. On saving that file, Git will then rewrite all the following commits as if the one you deleted didn't exist.

The Git Book has a good section on rebasing with pictures and examples.

Be careful with this though, because if you change something that you have pushed elsewhere, another approach will be needed.

Greg Hewgill
  • 1.0m
  • 193
  • 1.2k
  • 1.3k

AltStyle によって変換されたページ (->オリジナル) /