From: Junio C Hamano Date: Fri, 28 Feb 2020 20:22:26 GMT Subject: Re: GIT_DIR in aliases [Re: Spurious GIT_DIR set when in a worktree [was Re: Nested submodule status bug] Message-ID: In-Reply-To: <20200228190218.GC1408759@coredump.intra.peff.net> Jeff King writes: > Yes, the recommended thing is to make sure GIT_DIR is unset if you're > going to chdir around and expect auto-discovery of the repository to > work. > > Note there are other variables you might want to unset, too, if you're > switching repositories. Doing: > > unset $(git rev-parse --local-env-vars) > > would cover the full list. Thanks for mentioning --local-env-vars; I was going to ask you to mention GIT_WORK_TREE anytime you mention unsetting GIT_DIR, but you did it much better ;-).