Git revert local commit Git revert local commit windows windows

Git revert local commit


git reset --hard remotes/origin/HEAD


git reset --hard remotes/origin/YOUR/BRANCH

better than /HEAD because you won't see this:

$ git statusOn branch MY/BRANCHYour branch and 'origin/MY/BRANCH' have diverged,and have 1 and 1 different commit each, respectively.


If you feel sure about that and don't have any local uncommitted changes:

git reset --hard origin/master

where origin/master is the branch you had pushed to.

The ref-log will still contain the reverted bits, until a garbage collect expires them. To revert the revert,

git reset --hard HEAD@{1}