[Cialug] Git 'philosophy'

Ken MacLeod ken at bitsko.slc.ut.us
Fri Dec 18 10:33:25 CST 2009


On Fri, Dec 18, 2009 at 10:15 AM, L. V. Lammert <lvl at omnitec.net> wrote:
> Does anyone use Git in a consulting environment? Here is the situation:
>
>> I work from two or three different machines, and need to maintain a
> repository for my 'work'
>> There are other possible developers, so I have already setup a 'master'
> repository at the client.
>
> I had originally thought that having my OWN 'working' repository would
> allow me to share environments between office, laptop, & netbook, but git
> does not seem to like two repositories (at least I can't get it working).
>
> So, the question - is maintiaing a 'work' repository and a 'master'
> respository a valid topology?

Yes, with a tiny bit more effort and gotchas than a traditional
"central repository" tool like svn or cvs.

With git, each working directory will always have its own repository.
If you're using a "central repository" model with git then the central
repository will not have a working directory, it will be a "bare"
repository.  Users "pull" from and "push" to the central repository.

(Projects that use git as a fully distributed tool do not have a
"central repository", per se, what they have is a "lead developer" and
his or her main working repository.  The lead developer always "pulls"
from other developers.)

With git in a central repository model, you'll "git pull" in every
situation where you'd "cvs update" in cvs or svn.  You'll do both "git
commit" AND "git push" where you'd do a "cvs commit".

Like cvs or svn, "git push" will prevent two users from sending
changes to the central repository unless they're working from the most
recent code, but with git the issue is that you've already run "git
commit" to your local repository before you know that.  Doing a "git
pull" will sometimes "do the right thing" but at other times will put
you into a merge situation that I've found difficult to recover from.
I usually "git clone" a fresh copy and hand merge my updates into it
before committing the fresh repository.

  -- Ken


More information about the Cialug mailing list