From: Junio C Hamano Date: Fri, 07 Sep 2007 21:44:37 GMT Subject: Re: how to access working tree from .git dir? Message-ID: <7vhcm62lru.fsf@gitster.siamese.dyndns.org> In-Reply-To: <1189200421.12525.8.camel@beauty> Josh England writes: > ... there doesn't seem to be a > good way to access the top of the working tree from within the GIT_DIR. > Since I now know that post-receive has a CWD in .git, I could just use > `pwd`/../ , but I was hoping for a better (read: consistent between > hooks) solution. I do not think it is a bad thing for _your_ script to have the knowledge that in _your_ repositories everywhere, the top of the work tree is $GIT_DIR/.. and there is no repository that lacks a work tree. Obviously that would not work for people with bare repositories, but they would not be using _your_ script in their bare repositories, so that is Ok. You can also configure core.worktree in $GIT_DIR/config and use that from the hook script, I presume, although I haven't done it (and do not see a need to do so) myself yet.