Subject: Re: git ate my home directory :-(

From: Richard Weinberger <[email-masked]>
Date: Mon, 25 Mar 2013 23:27:10 +0100

Am 25.03.2013 23:20, schrieb Junio C Hamano:
> Richard Weinberger <[email-masked]> 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
>
> 	[core]
> 		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 ...
do_this
do_that
git reset --hard FETCH_HEAD
do_foo
git whatever

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

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

Thanks,
//richard