Git Help

Coleman Kane ckane at colemankane.org
Wed Mar 10 12:59:44 EST 2010


On Wed, 2010-03-10 at 12:27 -0500, Thomas Charron wrote:
> On Wed, Mar 10, 2010 at 11:46 AM, Coleman Kane <ckane at colemankane.org> wrote:
> > Do't use 'git branch' any more for creating new branches, instead use
> > 'git checkout'.
> 
>   Actually, I already knew that one, I was separating the logic in
> case it confused things.  :-D
> 
> > >From your description, I think I know what you are looking for. Consider
> > the following example where you edit the file 'test.c' and want to
> > commit those changes to a new branch named 'branch-2' rather than the
> > current branch ('master').
> 
>   And if my current branch is 'tom', with edited files, and I issue a
> git checkout -b tom2, then tom2 will now be a copy of tom, PLUS the
> edited file?
> 
> > Beware the HOWTO's out there, as the above sequence is the 'new way' of
> > doing this in git. The old way actually used 'git branch' for all the
> > branching operations and was more clumsy. This change happened within
> > the past two years.
> 
>   I gave up on the HOWTO's and just dove in.  :-D  Now I'm using git
> to allow an application which has a single configuration directory,
> ~/.skeinforge, to have multiple configuration by using a git wrapper
> which uses git branches as 'profiles'.
> 

Basically, the "repository" is the .git/ subdirectory. The working
directory is your local copy. Think of the current working directory as
your "local client directory" when you run "svn checkout http://.....".
Think of the .git/ subdirectory as the subversion repository on your
server.

Thinking in terms of SVN, when you run 'checkout -b tom2' when using the
'tom' branch, it's like running:
svn cp http://your-server.com/repos/toms-project/branches/tom http://your-server.com/repos/toms-project/branches/tom2
followed by
svn switch http://your-server.com/repos/toms-project/branches/tom2

The result is that you are now considered by the git software to be
working on files that belong in the 'tom2' branch, whereas before you
were working on files considered to belong in the 'tom' branch. However,
the status of all of the files in the working directory remains the
same. You still need to commit your changes to the present branch before
they'll be stored in the repository. In other words the files marked as
edited under 'tom' will still be marked 'edited' and not checked in
after the 'git checkout -b tom2'.

-- 
Coleman Kane



More information about the gnhlug-discuss mailing list