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:Androidgit-reposOurProject
on my machine. I then made some changes to the file
C:Androidgit-reposOurProjectHostAndroidsrccomourprojectclientSettingsActivity.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.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…