I am in the process of learning git.
I have the following commit on a branch
commit 3
commit 2
commit 1
commit 0
how can I remove commit 1 but keep commit 2 and 3 on a remote branch?
I am in the process of learning git.
I have the following commit on a branch
commit 3
commit 2
commit 1
commit 0
how can I remove commit 1 but keep commit 2 and 3 on a remote branch?
Two possible, different solutions:
git revert commit1; git push
- creates a new commit, which reverts commit 1
git rebase -i HEAD~3
then just delete the commit 1 and git push -f
but note this requires privilege to "force push" which means rewriting history which is not always desirable (do your research, this is typically viable only when working on code that has not been distributed/published/frozen). Refer to man pages for more details.