I know how to reset to a previous commit using git, but what is the proper way to remove a previous commit while still remaining at the current commit?
For example, I have commits w, x, y, z, but I want to remove x from the current working branch/tree/head/remote and still keep the rest of them.
How would I go about this?
git revert <id-of-commit>
This essentially creates a new commit with the "inverse diff" of id-of-commit
. All past commits remain untouched but Git tries to undo that single one.
Also, Git creates a new commit. This means you can simply push the revert to your remote repositories without messing with the history.