tags:

views:

60

answers:

4

I've been 'playing' with git on my own machine for 6 months now, and really loving it.

However, I'm finding it difficult to really grok how I would use it in a team/enterprisey environment. (I'm wondering whether Eric Sink is right).

I started out trying to install a git server on windows, but that didn't go too well.

So I wondered about just setting up a second repository on my own machine and starting to get a hang on pulling/pushing to that.

Do you know of any good articles for starting 'simple' like that, or do you have any tips on grokking the next level?

+1  A: 

Try Git Magic, which was the first thing I read when learning Git, and which was great for helping me understand what I was doing -- chapter 3 is all about dealing with more than one repository.

Etaoin
Excellent article, I haven't read all the way through yet, though
Benjol
+1  A: 

You may read some articles on Git daily work flow, and I would like to recommend two:

ZelluX
Nice, did you see that they are working on a 'git flow' add-on? http://github.com/nvie/gitflow/tree/0.2
Benjol
A: 

If:

  • your main computer is accessible through a shared path (\myMainComputer\MySharedDirectory)
  • or you have several repo on the same computer

You simply can:

  • git clone --bare /path/to/your/first/repo
  • cd /path/to/your/first/repo
  • git remote add bare_repo /path/to/bare/rep
  • (work, commits)
  • git push bare_repo
  • (if other have pushed to bare repo as well)
  • git pull bare_repo

In other words, the file protocole is supported as a legitimate URL for remote repos.
See git fetch, section URL:

For local repositories, also supported by git natively, the following syntaxes may be used:

/path/to/repo.git/
file:///path/to/repo.git/
VonC
Thanks, that's great.
Benjol
OK, now I've set up a bare, and two 'Devs' on my machine. I've managed to work out how to sync between each Dev and the 'server', but how do I share work on the same branch directly between devs, if they are already tracking that branch from the server? (This may be another question)
Benjol
OK, I worked it out, if it's not a tracking branch, you have to explicitly say which branch you want to pull from `git pull /path/to/dev2 Dev2BranchName`
Benjol
@Benjol: good point. A good guide when working on remote: http://help.github.com/remotes/
VonC
+1  A: 

This is the workflow that I try to stick to, with scripts to facilitate this workflow given here. The basic idea is to have at least two repositories:

(a) a general "central" remote repository, that serves as the canonical "primary" repo for all developers; code pushed here should always be (more or less) unbroken and functional, passing all tests, etc.

(b) a personal "work-in-progress"/development remote repository, which serves as a remote back-up for local or sub-team development. Code here can be in any state. Taking full advantage of Git's cheap branching, generally the wip topic development line should be in their own branches (as described in the above links), until ready for prime time. When the time comes around, merge into your local master, and then push this to the "primary" repository, and delete the wip branches from both your local as well as your personal remote development repos.

Optionally, you might want a third repo, for public (i.e., non-project team) consumption.

You also may want to look here for a description of a similar yet different workflow. By the way, the Pro Git book given in the previous link is, in my opinion, the single best Git resource currently out there.

Jeet