git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
DEDaniel Egger <daniel@eggers-club.de>
Date
Jan 15, 2016, 20:23 UTC
Message-ID
<FACC48AE-B1A9-4A13-9CC8-889996F3113D@eggers-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
Message 1 of 1 in “git worktree bug: paths are being reset to the main repository directory”
  1. Daniel EggerJan 15, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.