Committing Files Back to GitHub for Windows
git, github
Solution
Just to add to what VonC wrote...
Each time I attempted to hit the 'sync' button, I was shown the following screen
After reading what he suggested, I clicked on 'Open Shell' and typed
git stash
and it displayed something like this
After this I was able to hit the 'sync' button and it was able to sync successfully.
Added After Reading VonC's Comment
However, after adding that file successfully to the repo, I noticed that the other two build files ('BuildConfig.java' and 'project.properties') were not showing up in GitHub for Windows. So, after reading VonC's suggestion, I typed
git stash pop
in the shell that was opened earlier and then the two files appeared again on GitHub for Windows.
Added After Hearing Back from GitHub Support
Unfortunately you can't sync while you have unstaged changes or files. But there is one workaround:
- Commit everything in your working directory (use a commit message of "WIP" or something as short for "Work in Progress")
- Sync.
- Select the "WIP" commit and click the "rollback to this commit" button.
When you sync, local commits are taken and put at the end of the commits you got from the server.
Problem
I'm working on an Android project with my colleague and he recently setup a GitHub repo on https://github.com. At my end, I downloaded and installed GitHub for Windows on my 64-bit Windows 7 machine. I then proceeded to go to the repo on GitHub and clone the project using the 'Clone in Windows' button. Everything appeared to go smoothly and the project was at ``` C:\Android\git-repos\OurProject ``` on my machine. I then made some changes to the file ``` C:\Android\git-repos\OurProject\Host\Android\src\com\ourproject\client\SettingsActivity.java ``` I then observed that the changed file (along with some changed build files) did show up on the version of GitHub I had on my machine like this I selected the '`SettingsActivity.java`' file, filled in a short description and hit the '`Commit`' button. Then I saw the following screen Then, when I clicked on 'sync' hoping the changes I made would be pushed back to the master repo, I got the following message ``` unstaged changes You cannot sync with unstaged changes. Please commit your changes and try again. ``` Why did I get this error message? I did look at this thread What's the unstaged changes in github? and it seems that one has to do the following steps - git add - git commit - git push but from this thread What does GitHub for Windows' "sync" do? it might appear that the 'sync' button does all three? So, I'm not sure how to exactly stage my commits. I thought the fact that I had committed my changes (in the previous step) implied that I had staged them and that is why the option to sync was being offered. Any help in resolving this issue would be much-appreciated. P.S: I also reached out to the GitHub support team and have posted their solution below as well.