Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

github with Visual Studio 2013 - cannot pull because of uncommitted changes

I am a single developer right now, but I do have a workplace, and I also do work at home. Github is pretty ideal for me because the goal is to track my code, but also just keep it in a good repository so I don't lose it. So here is my work process...

  • Do work at home (site a)
  • commit changes to github frequently
    • sometimes, this will be up to 20 commits in a day, depending on productivity. I commit often.
  • go to other work site b (usually office)
  • clone repository at site b
    • this is done within visual studio, by going to Team Explorer -> Projects -> Connect to Team Projects, and then using Clone with the github repository URL.

clone

  • redownload nuget packages, etc - resume work as normal at site b for the day
    • I perform frequent commits here, as well.
  • return home (site a) and open up Visual Studio 2013
  • open up the project I was working on
  • go to Team Explorer -> Unsynched Commits and click Pull

pull

  • sometimes it works
  • sometimes, however, I receive the following error and I have no idea why

error

I would understand this if I had made edits to the current project before trying to pull - but I haven't. All I've done is loaded up Visual Studio. It says "See the Output window for details" but the Output window is completely blank - there are no details, and in this situation the only answer I've found is to delete the WHOLE project from my computer and clone the entire repository again.

Certainly this isn't right, I'm a complete newbie to git, and I have read the documentation over and over and this still makes no sense to me. Can anyone help shed some light on any of this?

like image 860
Ciel Avatar asked Jun 11 '14 12:06

Ciel


People also ask

Can you git pull with uncommitted changes?

When your uncommitted changes are significant to you, there are two options. You can commit them and then perform git pull , or you can stash them.

How do I see uncommitted changes in Visual Studio code?

Right-click your project suite in the Project Explorer and then click Source Control > Show Changes.

Does git push push uncommitted changes?

Git push command does it. These changes represent commitments performed on the repository and not the uncommitted changes (if any).


1 Answers

Before pull-ing you need to stash your uncommitted changes first. Visual Studio does not support full range of Git functionality yet, including git stash, so you have to do it through command line or use something like Source Tree in addition to Visual Studio for such occasion. Run git status -u to see uncommitted changes and git stash to temporarily hide them before pulling/syncing. Once in a while Visual Studio will cache the status results and will get out of sync with reality, in this case kill Studio, delete .git\ms-persist.xml file and restart.

like image 105
Ilya Kozhevnikov Avatar answered Sep 29 '22 12:09

Ilya Kozhevnikov