#git rebase -i <sha>
List of commits from git log
F--E--D--C--B--A
Lets say you want to remove commit D
from the commits.
git rebase -i E
This will open up an editor with all the commits since E
.
pick D commit message of D
pick C commit message of C
pick B commit message of B
pick A commit message of A
Delete line D
. Write and quit.
New commit log:
F--E--C--B--A
May have to push --force
to origin.
reference see Interactive http://git-scm.com/docs/git-rebase reference http://stackoverflow.com/a/37267/1478950
Just to avoid confusion, the new commit log would actually be:
F--E--C'--B'--A'
The commit hash for the commits above or after the changed commits will be different, even though the code changes are the same.