How to remove unsynced commits in github for windows?

gezhonglunta picture gezhonglunta · Feb 20, 2013 · Viewed 32k times · Source

I have two unsynced commits using GitHub (Windows), but don't want to commit them now. How can I revert or drop them?

screenshot

Answer

VonC picture VonC · Feb 20, 2013

As mentioned in "How to reach some commands on Github for windows", you best course of action would be to use to git CLI (command line interface), opening a shell from "GitHub for Windows", or using msysgit.

Then a git reset HEAD^2 (or even git reset --hard HEAD^2 if you really want to remove those files as well as any work in progress) would drop those commits (as in "How do I delete unpushed git commits?" or "How to delete a 'git commit'").

After a refresh, GitHub for Windows should display no more unsynced commit.

Other answers below mention the recent addition of "Undo most recent commit", which achieve the same reset:

Undo most recent commit


As I mentioned in "GitHub undo a discard", the "discard changes" feature would achieve the same as a git reset.