Krimson
Krimson

Reputation: 7674

How to sync changes done to remote repo on diff computer?

I have the following situtation:

Now when I work on Computer 2,
How do I sync the local repo with the newly made changes in the remote repo?

Upvotes: 0

Views: 70

Answers (2)

user456814
user456814

Reputation:

It's not clear from the question, but I'm going to assume that the remote repo for both computers 1 and 2 are the same, and that the repo is cloned to both machines.

Then to sync changes from computer 1 to 2, you can simply push the changes from 1 to the remote repo, then you can fetch or pull them to 2:

# From computer 1
git push <remote> <branch>

# From computer 2
git fetch <remote>
git checkout <branch>
git merge <remote>/<branch>

# Or do the above in 2 steps
git checkout <branch>
git pull <remote> <branch>

These are Git basics that you can read about from the link that dzada posted, Git Basics - Working with Remotes. I highly recommend that you read that and the other chapters in the book, in particular chapters 1-3 and 6-6.5. It's a FREE online book.

Upvotes: 2

dzada
dzada

Reputation: 5874

Add the repository from computer X to the repo on computer Y directly without passing from your central one. See here, how to add a connection directly between X and Y.

X ---- central / origin ------- Y

more documentation here :http://git-scm.com/book/en/Git-Basics-Working-with-Remotes

Upvotes: 0

Related Questions