Git development
 help / color / mirror / Atom feed
From: Phillip Susi <phill@thesusis.net>
To: git@vger.kernel.org
Subject: GIT_WORK_TREE; a recipe for disaster
Date: Tue, 03 Mar 2020 08:53:31 -0500	[thread overview]
Message-ID: <875zflh7dw.fsf@vps.thesusis.net> (raw)

I'm using git for windows version 2.25.0.windows.1.  Yesterday I was in
a bash command line and changed directories to another project.  I ran
git status and it complained about basically everything being deleted
when the files were sitting there just fine.  I thought that maybe it is
confused since I upgraded git recently and so I ran git checkout -f and
git clean -xfd to make sure that the working directory would be restored
to a pristine state.  I later changed back to the first project
directory where I was horrified to see that all of the files from the
second project had been checked out, and the changes in that project
that I had been working on for a few days had been deleted.

It seems the cause of this is that I had opened git bash from the git
gui menu instead of from the windows explorer menu.  In previous
releases, this cause GIT_DIR to be set ( I believe ), and so that
session of git bash was tied to that repoistory even if you changed
directories to another repository.  I always thought this was rather
annoying, but things seem to be worse now that I have upgraded, because
git now uses the index and hisotry log etc from the cwd, but compares
that index to files elsewhere.  This seems like a recipe for disaster.
Why does git gui set these environment variables at all, and could it
please stop?


             reply	other threads:[~2020-03-03 14:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-03 13:53 Phillip Susi [this message]
2020-03-03 14:22 ` GIT_WORK_TREE; a recipe for disaster Philip Oakley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875zflh7dw.fsf@vps.thesusis.net \
    --to=phill@thesusis.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox