I would like to know how to delete a commit.
By delete
, I mean it is as if I didn\'t make that commit, and when I do a push in the future, my changes wi
Here's another way to do this:
Checkout the branch you want to revert, then reset your local working copy back to the commit that you want to be the latest one on the remote server (everything after it will go bye-bye). To do this, in SourceTree I right-clicked on the and selected "Reset BRANCHNAME to this commit". I think the command line is:
git reset --hard COMMIT_ID
Since you just checked out your branch from remote, you're not going to have any local changes to worry about losing. But this would lose them if you did.
Then navigate to your repository's local directory and run this command:
git -c diff.mnemonicprefix=false -c core.quotepath=false \
push -v -f --tags REPOSITORY_NAME BRANCHNAME:BRANCHNAME
This will erase all commits after the current one in your local repository but only for that one branch.