Question

I want to utilize git in my development workflow. I'm using Eclipse Juno. I'm coming from CVS, but see lots of benefits from distributed VCS. I'm reading Pro Git book, have read quite bit of it to start using it, but somehow something does not work the way I think it should to. I'm doing well with it on single machine, but fail when I do remote repository sync.

This is what I want to achieve:

I have two PC-s, HOME & WORK. I want to develop on both PC, so chose git to sync them as well. I created repository on the THUMB drive, and cloned it on HOME & WORK.

now, I want to develop on either HOME or WORK, commit locally, sync with THUMB, and then sync with another PC (HOME or WORK).

what commands should I issue to do this? (for example WORK -> THUMB -> HOME)

Was it helpful?

Solution

Basic workflow is commit locally using:

$ git add .
$ git commit -m "Commit message"

Until done, then:

# Push the 'master' branch to the 'thumb' repository
$ git push thumb master

Now switch the thumb drive to the other pc and then:

# Pull from the 'thumb' drive into your local repo
$ git pull thumb master

OTHER TIPS

So in your case THUMB is like an online central repository. If you cloned both WORK and HOME from the THUMB, it should be set up as a remote named origin on both PC-s, which is great.

So now when you make changes on WORK, you need to git push. It should automatically push the changes you made to the origin, so in your case to THUMB.

Then on HOME you need to either git fetch and then manually merge your master with origin/master or git pull. This is a matter of preference and I am sure that Pro Git explains it better than I could.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top