I have a local and its corresponding github repo. I have some commits as
A <- B <- C <- D
A being the latest.
This is situ
Git-rebase is what are you looking for.
in your case of commit A-B-C-D
, and want to remove C, try:
git rebase -i HEAD~3
it will show the last 3 of your commits via editor (mine is vim),
just delete (in vim: dd
) the line of commit you want to remove,
then save it (in vim: :wq
).
Done, view the git log
and you will see that the C
commit is removed.
*don't forget to backup your code or .git folder.