git branch help?

Matt McCutchen matt at mattmccutchen.net
Tue Aug 3 06:48:38 UTC 2010


On Tue, 2010-08-03 at 08:16 +0200, Kevin Kofler wrote:
> Matt McCutchen wrote:
> > The only potentially confusing behavior was that git defaulted to
> > pushing all branches.  Given that, the push failed due to a concurrent
> > change to a different branch on the destination, and it was necessary to
> > switch to that branch in order to perform the merge (well, rebase, but
> > the difference isn't important here).  I see nothing arcane, exotic,
> > bizarre, or broken about that.  And I don't think I would change the
> > default push behavior: I can envision forgetting to push a change to a
> > non-current branch until someone complains about it.
> 
> The whole idea of having more than one branch in a checkout is confusing.

This may be a terminology issue.  A personal repository may contain all
the branches, but only one branch is checked out in a given working
directory at any time.  It would be the same if you had an entire SVN
repository cached locally and could "svn switch" among the branches.

Note that Neal only ran into trouble because he had an outgoing change
in a non-checked-out branch.  If you only ever have one branch checked
out, you'll never get into that situation.

> I really don't see why I'd want to have a complete clone of the repository on 
> my HDD rather than a working copy which contains all I actually work on (the 
> current revision

This is a valid point.  git supports shallow clones, but I would like to
see support for querying remote repositories.  In the meantime, you may
be able to use the gitweb (or similar) interface.

> of one branch; if I work on multiple branches, that's what 
> directories on my file system are for).

One can hang multiple working directories for different branches off the
same git repository.  I do it all the time.  It's also possible to share
only the object database without the branch namespace, but I find that
the convenience of having all the branches readily accessible for
queries is enormous.

-- 
Matt



More information about the devel mailing list