# Problem with --work-tree

3 messages from 2008-08-16 to 2008-08-18. Participants: Сергей Шарыбин, Nguyen Thai Ngoc Duy, Michael J Gruber.
Thread: https://gitlist.dev/t/15041

## Сергей Шарыбин, 2008-08-16 21:14

Subject: Problem with --work-tree
Message-ID: <48A74325.1040805@school9.perm.ru>
URL: https://gitlist.dev/e/48A74325.1040805%40school9.perm.ru

```
Hi,

I've got the following problem. I've got a GIT repo at 
/home/nazgul/src/test-work-tree and I've got some changed files in this 
repo. I want to see this changes when a `git` runs outside this 
directory. I tried to run `git 
--git-dir=/home/nazgul/src/test-work-tree/.git 
--work-tree=/home/nazgul/src/test-work-tree diff-index --name-status 
HEAD` from my home directory. In such way diff-index tells me that all 
files from my repo has been deleted. I think it is because this command 
does not understand a --work-tree parameter. And I saw the same problem 
with a git diff command (something like that: git 
--git-dir=/home/nazgul/src/test-work-tree/.git 
--work-tree=/home/nazgul/src/test-work-tree diff).

I use git version debian.1.5.6.3.1

Is it my mistake or it is bugs in a GIT?

-- 
With best regards, Sergey I. Sharybin

```

## Nguyen Thai Ngoc Duy, 2008-08-17 05:24

Subject: Re: Problem with --work-tree
Message-ID: <fcaeb9bf0808162224u2d337878vb1dfef09a6b48a16@mail.gmail.com>
URL: https://gitlist.dev/e/fcaeb9bf0808162224u2d337878vb1dfef09a6b48a16%40mail.gmail.com
In-Reply-To: <48A74325.1040805@school9.perm.ru>

```
On 8/17/08, Сергей Шарыбин <nazgul@school9.perm.ru> wrote:
> Hi,
>
>  I've got the following problem. I've got a GIT repo at
> /home/nazgul/src/test-work-tree and I've got some changed
> files in this repo. I want to see this changes when a `git` runs outside
> this directory. I tried to run `git
> --git-dir=/home/nazgul/src/test-work-tree/.git
> --work-tree=/home/nazgul/src/test-work-tree diff-index
> --name-status HEAD` from my home directory. In such way diff-index tells me
> that all files from my repo has been deleted. I think it is because this
> command does not understand a --work-tree parameter. And I saw the same
> problem with a git diff command (something like that: git
> --git-dir=/home/nazgul/src/test-work-tree/.git
> --work-tree=/home/nazgul/src/test-work-tree diff).

I think it's a bug. For now use "git status" instead.
-- 
Duy

```

## Michael J Gruber, 2008-08-18 09:32

Subject: Re: Problem with --work-tree
Message-ID: <g8bfjc$551$1@ger.gmane.org>
URL: https://gitlist.dev/e/g8bfjc%24551%241%40ger.gmane.org
In-Reply-To: <48A74325.1040805@school9.perm.ru>

```
Сергей Шарыбин venit, vidit, dixit 16.08.2008 23:14:
> Hi,
> 
> I've got the following problem. I've got a GIT repo at 
> /home/nazgul/src/test-work-tree and I've got some changed files in this 
> repo. I want to see this changes when a `git` runs outside this 
> directory. I tried to run `git 
> --git-dir=/home/nazgul/src/test-work-tree/.git 
> --work-tree=/home/nazgul/src/test-work-tree diff-index --name-status 
> HEAD` from my home directory. In such way diff-index tells me that all 
> files from my repo has been deleted. I think it is because this command 
> does not understand a --work-tree parameter. And I saw the same problem 
> with a git diff command (something like that: git 
> --git-dir=/home/nazgul/src/test-work-tree/.git 
> --work-tree=/home/nazgul/src/test-work-tree diff).
> 
> I use git version debian.1.5.6.3.1
> 
> Is it my mistake or it is bugs in a GIT?

Working from a path outside the work tree is broken (read: not meeting
the obvious/naive meaning of the --work-tree option and core.worktree
setting) in many places, unfortunately. Some commands work with
--git-dir and the like, but some just don't. I use a shell alias which
cds into the work tree first. This works with everything except for some
stubborn tcl/tk scripts doing their own thing (gui...) in case git-dir
and work-tree are not in the standard places (.git, .).

Michael

```
