# git worktree bug: paths are being reset to the main repository directory

1 messages from 2016-01-15 to 2016-01-15. Participants: Daniel Egger.
Thread: https://gitlist.dev/t/41203

## Daniel Egger, 2016-01-15 20:23

Subject: git worktree bug: paths are being reset to the main repository directory
Message-ID: <FACC48AE-B1A9-4A13-9CC8-889996F3113D@eggers-club.de>
URL: https://gitlist.dev/e/FACC48AE-B1A9-4A13-9CC8-889996F3113D%40eggers-club.de

```
Hi guys,

doing a git reset --hard in one of the worktrees will reset the path in $GIT_DIR/worktrees/worktree_name/gitdir to .git, so after that point all thusly modified worktrees will look as if they live in current woorktree root.

State before:

# cd /Users/user/Desktop/Source/Product && git worktree list
/Users/user/Desktop/Source/Product          2991e32 [master]
/Users/user/Desktop/Source/Product-2.1      3fc1082 [releases/master-2.1]
/Users/user/Desktop/Source/Product-2.2      3ccc3fe [releases/master-2.2]
/Users/user/Desktop/Source/Product-2.3      4044881 [releases/master-2.3]
/Users/user/Desktop/Source/Product-2.3-S11  4a67d36 [customer/S11]
/Users/user/Desktop/Source/Product-2.2-S22  2d2503a [customer/S22]

# pushd /Users/user/Desktop/Source/Product-2.2; git reset --hard; popd

# git worktree list
/Users/user/Desktop/Source/Product          2991e32 [master]
/Users/user/Desktop/Source/Product-2.1      3fc1082 [releases/master-2.1]
/Users/user/Desktop/Source/Product          3ccc3fe [releases/master-2.2]
/Users/user/Desktop/Source/Product-2.3      4044881 [releases/master-2.3]
/Users/user/Desktop/Source/Product-2.3-S11  4a67d36 [customer/S11]
/Users/user/Desktop/Source/Product-2.3-S33  174575e [customer/S33]
/Users/user/Desktop/Source/Product-2.2-S22  2d2503a [customer/S22]

3ccc3fe is now (incorrectly) claimed to be represented in <pwd>.

Servus,
      Daniel

```
