Am 25.03.2013 23:20, schrieb Junio C Hamano:
Richard Weinberger <> writes:

Okay, I have to set GIT_DIR _and_ GIT_WORK_TREE to make my scripts safe again?
I've always set only GIT_DIR because it just worked (till today...).

That means you never run your script inside a subdirectory ;-)

If your $GIT_DIR is tied to a single working tree, a simpler way
would be to add

                worktree = /path/to/the/work/tree/

I've used GIT_DIR in my scripts because changing the current working directory
within bash scripts often causes problem with other commands.
That's why I've used patters like:
export GIT_DIR=/path/to/repo/.git
git fetch ...
git reset --hard FETCH_HEAD
git whatever

export GIT_DIR=/path/to/another/repo/.git
git fetch ...

But from now on I'll simply cd into the git repo...

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to