GitHub For Windows: Sync Failed With Uncommitted Changes


If you have been programming for some time, or have interest in keeping up with changes in the tech scene, then there is no doubt you have probably come across GitHub by now. If you are an adventerous programmer, you might even use it for your own projects or to contribute to various open source projects. GitHub is a commercial endeavor built around git, and they do fairly well for themselves, and provide a great service.

If you are an experienced user of git, this post probably won't apply too much, but if you are just getting the hang of using git for your version control, or need a nice GUI for your repositories, you might be using the GitHub for Windows (I might have forgotten to mention this post is about the Windows version of GitHub for Windows).

After working with GitHub for Windows for a while, it is possible you have come across this annoying message:

You cannot sync with uncommitted changes. Please commit your changes and try again.

GitHub for Windows | Sync failed error message.

There is an easy solution to this that doesn't include commiting your half-done work. In the top-right corner of the window, you will see a gear. Clicking/tapping this gear will open a drop-down menu, and you will see an option called "Open in Git Shell". Selecting this option will open your repository in whatever command-line environment you have configured within the GitHub for Windows settings.

Opening the repository in git shell.

Using git push

Once the command-line environment opens, type the following command:

git push

This will push all the changes you have committed to your repository, and you can get back to work! Thats all there is to this method, thanks to the many readers (below) who have suggested this method - I'm always learning new things!

Using git stash

Again, once the command-line environment opens, type this command:

git stash

After pressing enter, you should be able to return to the GitHub for Windows app and press the "Sync" button without any problems! This works because the git stash command takes any files that are being tracked by git and just sets them off to the side for you. Once you stash something in git, as far as its concerned those changes are not part of working set. Of course, you probably want your changes back after you have synced your repository.

To get your changes back, return to the command line environment and enter this command:

git stash pop

The git stash pop command takes the changes you have previously stashed, or set off to the side, and puts them back into your working set.

There you go! Now you know how to get around the annoying pop-up message that might plague you for a while while using GitHub for Windows! If you found this post helpful, share it around with your friends, leave a comment, or just sit there awkwardly. It's really up to you.

Join the Discussion

Leave a comment

  • Dave Voyles
    Dave Voyles
    June 18, 2014 1:10 PM Reply

    Worked like a charm! I just started to have this issue today, and this resolved it immedaitely. Thank you.

      Johnathon Koster
      Johnathon Koster
      June 19, 2014 9:31 PM Reply

      I'm glad this post helped you out! As others have mentioned, using git push will also work. Less key strokes required!

  • Akram
    June 19, 2014 3:12 AM Reply

    I simply do git push. No need to put to stash and pop it.

      Johnathon Koster
      Johnathon Koster
      June 19, 2014 2:59 PM Reply

      Akram, thanks for your tip. It is definitely shorter to use. However, some people might really want to press that 'Sync' button ;)

  • Alex
    June 19, 2014 5:43 PM Reply

    Hi, I think devs are wanted force us to use cmd for this, btw git push works great without stashig (that useful when you got conflicts).

    Regards, Alex.

  • Alex Nissart
    Alex Nissart
    June 21, 2014 8:57 AM Reply

    Thank you John for the solution, but it should be a Github for Windows issue, since it only happens since I update the software to the latest version a few days ago.

Subscribe to our newsletter