gitgithubgithub-for-windowsgithub-desktop

Rollback uncommitted changes in GitHub Desktop (or Github for Windows)


I'm using Github Desktop (previously called GitHub for Windows) and I made a bunch of changes to my local files. It became such a mess that I decided I just want to rollback my local files to where they were the last time I made a commit. I haven't committed the new changes - I just want to get rid of them. How can I do this?


Solution

  • In keeping up with the times, Github for Windows has had a huge makeover, so here's a new answer. It's now called Github Desktop and the version numbers have started back at v1.0.0. So if you're running Github Desktop v1 then your UI is going to look a little different.

    This super-handy, always-hidden little feature, however, is still there.

    First, select your repository in the far-left dropdown in the black area. Make sure you then select the tab that says "Changes". Now you can right-click anywhere in the rectangle that contains "{#} changed files" and you'll get a pop-up that says "Discard all changes..." Click that and, presto, you're back to where you were the last time you made a commit.

    Bonus: You can also right-click any of the changed files to get a pop-up that will enable you to "Discard changes..." for only that file. Click that and only that file will revert back to where it was at the last commit.

    enter image description here

    The Github Desktop documentation now includes information on how to discard changes. It is, however, incorrect! When you right-click an individual file the pop-up does not give the option to "Discard all changes..." as their screen shot seems to indicate. To discard all changes you need to do as I describe above.