GIT_WORK_TREE; a recipe for disaster

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux