tags:

views:

144

answers:

2

Bob and Alice got the ssh access to a RemoteMachine, they work together with ProjectA. Assume Alice has a repos in her home directory

RemoteMachine/home/alice/ProjectA

while Bob will firstly clone Alice's repos to (with --bare is better maybe)

RemoteMachine/home/bob/ProjectA

Bob will not edit ProjectA directly in the RemoteMachine. So maybe he want to clone from his remote Repos RemoteMachine/home/bob/ProjectA to LocalMachine(Why not bob directly clone from Alice? Maybe Alice want to pull directly from RemoteMachine/home/bob/ProjectA).

git clone bob@RemoteMachine:/home/bob/ProjectA LocalMachine/home/bob/PrjA

My question is:

What is the best practise to achieve this(see below)?

  • I can edit locally and push to RemoteMachine/home/bob maybe with:

    Local/bob/repos> git push

  • I can run the reset command in my LocalMachine still can reflect to RemoteMachine/home/bob that Alice can pull from

    Local/bob/repos> reset --hard HEAD^

  • I can fetch what Alice changes in my LocalMachine.

I don't know the if these needs are reasonable, so if you find it's not, just propose yours and explain why. It'll be appreciate if you can show the workflows with git command in that situation.

+1  A: 

If you're going to use push, it's usually best to have a 3rd repository that was cloned from the original using --bare and have all developers push there.

Hank Gay
A: 

Your workflow sounds reasonable to me. You've got Alice and Bob each with their own 'sharable' repos on RemoteMachine, and each presumably pulling down from there to a LocalMachine to develop on. When they finish something they want to share, they can just push it to their repo on RemoteMachine, where it's visible to the other person. One thing I think you left out is another repo owned by Quinn in QA. When Alice and/or Bob decide something is production worthy, they push over to Quinn's repo. Quinn then takes that and runs it through his rigorous set of tests and such and eventually if it passes he pushes out a new package. Alternately, Quinn could be some kind of Continuous Integration robot like Hudson or CruiseControl or somesuch that does the autobuild and testing steps. This repo, be it owned by Quinn or a buildbot, is also likely the place that Alice and Bob sync their repos from with pulls - it's the 'canonical' set of code that everyone develops against.

The workflow you outlined is fine, as far as it goes. I hope this answer helped.

pjz