We have some commit on git which was wrongly added We have done some more commits also above that wrong commit. Now I want to remove that commit without affecting on other commits.
Is there any way to remove it?
Please guide
We have some commit on git which was wrongly added We have done some more commits also above that wrong commit. Now I want to remove that commit without affecting on other commits.
Is there any way to remove it?
Please guide
remove that commit without affecting on other commits
Use git revert
: that will create a new commit which will cancel the ones you don't want to see. You will be able to push that new commit.
You can revert a range of commits.
But that means the data from those "wrong comimts" remains in the history.
You can revert any commit, regardless of where it is in your history. Just type git revert <sha>
.
You may have to do a conflict resolution if there are conflicts.