1

I have two PCs, with Visual Studio installed. Currently, I am a part of a team, and our project is synchronized using Git extension of Visual studio, at our project repository at the online Visual Studio site (http://www.visualstudio.com/). When I make a change, and I commit, the site shows that the change was done by me, while if someone else make a change, it shows the name of the other guy. However I also have a second PC, and I also want to work from there as well. I will connect to the second visual studio using my online visual studio account as the first one.

My question is therefore:

If I have two visual studio connected with my online visual studio account, and both visual studios synchronize our code with the online Visual Studio Git repository, is it possible that the Git gets confused, and make any unwanted changes (i.e. when I commit from my second PC to delete things I had committed before with my first PC, or anything similar)?

Chris Martin
  • 30,334
  • 10
  • 78
  • 137
Jim Blum
  • 2,656
  • 5
  • 28
  • 37

1 Answers1

1

is it possible that the Git gets confused, and make any unwanted changes (i.e. when I commit from my second PC to delete things I had committed before with my first PC, or anything similar)?

No, because to be able to push to the remote repo, you would have to pull first (or pull --rebase), in order to:

  • integrate the remote most recent commits,
  • test that it is still working locally
  • push

That means you are only pushing in a fast-forward mode (i.e adding new commits).

If those new commits were to delete work done on the first PC, you would realize it and fix it when you are back at said first PC and pull the latest commits.

But if you have pushed your work from the first PC before going to the second, and pull those commits on the second PC, there is no reason that you would push (from the second PC) any commits deleting the work done on the first PC.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • So that means that it will never be confused no matter who is logged in – Jim Blum Jan 21 '14 at 13:29
  • @JimBlum yes, it has nothing to do with *who* is logged in. It has everything to do with how you synchronize your work (do you push before leaving your first PC, do you pull before working on your second PC?). – VonC Jan 21 '14 at 13:31
  • Thanks a lot, for your excellent answer. You have just got my upvote and best answer flag :) – Jim Blum Jan 21 '14 at 13:33