Re: git ate my home directory :-(
- From
Richard Weinberger <richard@nod.at>
- Date
- Mar 25, 2013, 22:27 UTC
- Message-ID
- <5150CF3E.9020808@nod.at>
- In-Reply-To
- <7v38vjw28v.fsf@alter.siamese.dyndns.org>
Am 25.03.2013 23:20, schrieb Junio C Hamano:
Show 12 quoted lines
> Richard Weinberger <richard@nod.at> 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