* What's a "work tree"?
@ 2008-01-24 19:09 Mike
2008-01-25 6:14 ` Jeff King
0 siblings, 1 reply; 4+ messages in thread
From: Mike @ 2008-01-24 19:09 UTC (permalink / raw)
To: git
I'm trying to figure out what a "work tree" is. as in --work-tree.
This is a new command right, the tutorials I've read don't have it. The
man page has the syntax but I don't know what it's for.
$ cd /www/mysitedocroot
$ git --git-dir /gitdir/mysitegit/ add .
fatal: add must be run in a work tree
thanks
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: What's a "work tree"?
2008-01-24 19:09 What's a "work tree"? Mike
@ 2008-01-25 6:14 ` Jeff King
2008-01-25 20:54 ` Mike
0 siblings, 1 reply; 4+ messages in thread
From: Jeff King @ 2008-01-25 6:14 UTC (permalink / raw)
To: Mike; +Cc: git
On Thu, Jan 24, 2008 at 02:09:33PM -0500, Mike wrote:
> I'm trying to figure out what a "work tree" is. as in --work-tree. This
> is a new command right, the tutorials I've read don't have it. The man
> page has the syntax but I don't know what it's for.
The work tree is the place where your checked out files reside. E.g.,
in an ordinary repo (made with "git init" or "git clone") everything
that isn't in the .git directory.
> $ cd /www/mysitedocroot
> $ git --git-dir /gitdir/mysitegit/ add .
> fatal: add must be run in a work tree
You are using --git-dir to point to a repository directory that isn't
".git". That's OK, and it will generally assume that your current
directory is the work tree. E.g., this works:
mkdir repo && cd repo
git init
mv .git mygitdir
touch file
git --git-dir=mygitdir add file
However, there is a config option "core.bare" which indicates that a
repository is "bare", meaning that it has no work tree (and that is
presumably what's happening in your example). So you could use
--work-tree=. to override that in your example (though you might just be
better off setting config.bare to false).
The more probable use case for --work-tree is something like
$ cd /gitdir/mysitegit
$ git --work-tree=/www/mysitedocroot add .
i.e., you are in the git dir, so you specify the work tree rather than
the other way around. You could even do this:
$ cd /some/other/directory
$ git --git-dir=/gitdir/mysitegit --work-tree=/www/mysitedocroot add .
although I'm not sure it's that useful.
-Peff
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: What's a "work tree"?
2008-01-25 6:14 ` Jeff King
@ 2008-01-25 20:54 ` Mike
2008-01-25 21:56 ` Jeff King
0 siblings, 1 reply; 4+ messages in thread
From: Mike @ 2008-01-25 20:54 UTC (permalink / raw)
To: Jeff King; +Cc: git
Jeff King wrote:
> On Thu, Jan 24, 2008 at 02:09:33PM -0500, Mike wrote:
>
>> I'm trying to figure out what a "work tree" is. as in --work-tree. This
>> is a new command right, the tutorials I've read don't have it. The man
>> page has the syntax but I don't know what it's for.
>
> The work tree is the place where your checked out files reside. E.g.,
> in an ordinary repo (made with "git init" or "git clone") everything
> that isn't in the .git directory.
>
>> $ cd /www/mysitedocroot
>> $ git --git-dir /gitdir/mysitegit/ add .
>> fatal: add must be run in a work tree
>
> You are using --git-dir to point to a repository directory that isn't
> ".git". That's OK, and it will generally assume that your current
> directory is the work tree. E.g., this works:
>
> mkdir repo && cd repo
> git init
> mv .git mygitdir
> touch file
> git --git-dir=mygitdir add file
>
> However, there is a config option "core.bare" which indicates that a
> repository is "bare", meaning that it has no work tree (and that is
> presumably what's happening in your example). So you could use
> --work-tree=. to override that in your example (though you might just be
> better off setting config.bare to false).
>
> The more probable use case for --work-tree is something like
>
> $ cd /gitdir/mysitegit
> $ git --work-tree=/www/mysitedocroot add .
>
> i.e., you are in the git dir, so you specify the work tree rather than
> the other way around. You could even do this:
>
> $ cd /some/other/directory
> $ git --git-dir=/gitdir/mysitegit --work-tree=/www/mysitedocroot add .
>
> although I'm not sure it's that useful.
>
> -Peff
Yes, thanks, I was actually following this tutorial:
http://www.kernel.org/pub/software/scm/git/docs/cvs-migration.html
Which is how I ended up with a "bare" git dir. Which actually I think
I'm ok with, seems to work ok.
For others with the same questions, here's how I found what work-tree
means last night:
http://www.kernel.org/pub/software/scm/git/docs/glossary.html
I think I got there through the git wiki.
Also- I found out I needed a newish version of git to get the
--work-tree argument. The CentOS repos have an older version, 1.2.something.
thanks
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: What's a "work tree"?
2008-01-25 20:54 ` Mike
@ 2008-01-25 21:56 ` Jeff King
0 siblings, 0 replies; 4+ messages in thread
From: Jeff King @ 2008-01-25 21:56 UTC (permalink / raw)
To: Mike; +Cc: git
On Fri, Jan 25, 2008 at 03:54:55PM -0500, Mike wrote:
> Yes, thanks, I was actually following this tutorial:
>
> http://www.kernel.org/pub/software/scm/git/docs/cvs-migration.html
>
> Which is how I ended up with a "bare" git dir. Which actually I think
> I'm ok with, seems to work ok.
Ah, OK. The normal use case would then be to clone that bare repository
(though you seem to be directly exposing the work tree with the
webserver, so you may not want to have the .git directory there -- there
was a long-ish thread about that a week or two ago).
> Also- I found out I needed a newish version of git to get the
> --work-tree argument. The CentOS repos have an older version,
> 1.2.something.
Yes, that is ancient in git terms (in particular, pre-1.5.x has a number
of interface differences). The work-tree option was added in 1.5.3.
-Peff
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-01-25 21:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-24 19:09 What's a "work tree"? Mike
2008-01-25 6:14 ` Jeff King
2008-01-25 20:54 ` Mike
2008-01-25 21:56 ` Jeff King
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).