{"thread":{"id":"50870","subject":"fatal: ... is already checked out at ...","startedAt":"2019-04-03T22:15:27Z","lastAt":"2019-04-04T08:30:46Z","messageCount":2,"participants":["Mark Kharitonov","Eric Sunshine"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"373077","messageId":"CAG2YSPzAiJW1tH7xm9bqh00VYZrpFS4RQLZ4HK7aWoPm2RxD0g@mail.gmail.com","threadId":"50870","inReplyTo":null,"subject":"fatal: ... is already checked out at ...","fromName":"Mark Kharitonov","fromEmail":"mark.kharitonov@gmail.com","sentAt":"2019-04-03T22:15:13Z","receivedAt":"2019-04-03T22:15:27Z","isPatch":false,"sender":{"key":"mark.kharitonov@gmail.com","avatar":"https://gravatar.com/avatar/ebee0a786b7cfc7a49e9d93b057b6fc3f62c01f916755f2c26e67ec8c2b2652c?d=mp&s=160"},"body":"Hi,\nPlease, observe:\n\nC:\\Dayforce\\56 [release/r-856 ≡]> git --version\ngit version 2.18.0.windows.1\nC:\\Dayforce\\56 [release/r-856 ≡]> git worktree list\nC:/Dayforce/tip    c80539e06d [arch/shelve/532684]\nC:/Dayforce/55     1362776f49 [release/r-855]\nC:/Dayforce/55WFM  0000000000 [wfm/855wfm]\nC:/Dayforce/56     f9c36d3a2b [release/r-856]\nC:/Dayforce/56     f9c36d3a2b [release/r-856]\nC:/Dayforce/hf56   5f1837a3f6 [hotfix/856]\n\nItem #1 - how come I have two instances of release/r-856 in the git\nworktree list output?\nNext:\n\nC:\\Dayforce\\56 [release/r-856 ≡]> git co onboarding/r-856/james-config\nChecking out files: 100% (2055/2055), done.\nSwitched to branch 'onboarding/r-856/james-config'\nYour branch is up to date with 'origin/onboarding/r-856/james-config'.\nC:\\Dayforce\\56 [onboarding/r-856/james-config ≡]> git co release/r-856\nfatal: 'release/r-856' is already checked out at 'C:/Dayforce/56'\n\nItem #2 - why cannot I checkout release/r-856, if I am already in the\nright working tree? I suppose it is connected to item #1\nNext:\n\nC:\\Dayforce\\56 [onboarding/r-856/james-config ≡]> git co -B\nrelease/r-856 $(git rev-parse release/r-856)\nChecking out files: 100% (2055/2055), done.\nSwitched to and reset branch 'release/r-856'\nYour branch is up to date with 'origin/release/r-856'.\nC:\\Dayforce\\56 [release/r-856 ≡]>\n\nThis is how I forced the checkout.\n\nDoes not seem right. Is it a git bug or is it something we are doing wrong?\nThank you.\n\n-- \nBe well and prosper.\n==============================\n\"There are two kinds of people.Those whose guns are loaded and those who dig.\"\n   (\"The good, the bad and the ugly\")\nSo let us drink for our guns always be loaded.\n"},{"id":"373100","messageId":"CAPig+cSqH44wWRiESm=UA1k9V6S_jmF-hyQp34XaUJuZWQ1aYg@mail.gmail.com","threadId":"50870","inReplyTo":"CAG2YSPzAiJW1tH7xm9bqh00VYZrpFS4RQLZ4HK7aWoPm2RxD0g@mail.gmail.com","subject":"Re: fatal: ... is already checked out at ...","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2019-04-04T08:30:31Z","receivedAt":"2019-04-04T08:30:46Z","isPatch":false,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Wed, Apr 3, 2019 at 6:15 PM Mark Kharitonov\n<mark.kharitonov@gmail.com> wrote:\n> C:\\Dayforce\\56 [release/r-856 ≡]> git --version\n> git version 2.18.0.windows.1\n> C:\\Dayforce\\56 [release/r-856 ≡]> git worktree list\n> [...]\n> C:/Dayforce/56     f9c36d3a2b [release/r-856]\n> C:/Dayforce/56     f9c36d3a2b [release/r-856]\n>\n> Item #1 - how come I have two instances of release/r-856 in the git\n> worktree list output?\n>\n> C:\\Dayforce\\56 [release/r-856 ≡]> git co onboarding/r-856/james-config\n> Switched to branch 'onboarding/r-856/james-config'\n> Your branch is up to date with 'origin/onboarding/r-856/james-config'.\n> C:\\Dayforce\\56 [onboarding/r-856/james-config ≡]> git co release/r-856\n> fatal: 'release/r-856' is already checked out at 'C:/Dayforce/56'\n>\n> Item #2 - why cannot I checkout release/r-856, if I am already in the\n> right working tree? I suppose it is connected to item #1\n\nYou probably hit the bug reported in [1], which was fixed by [2] which\nmade it into Git 2.20.0. Specifically, prior to 2.20.0, you could get\ninvalid duplicate worktree entries like this:\n\n    $ git worktree add foo bar\n    $ rm -rf foo\n    $ git worktree add foo bar\n    $ git worktree list\n    ...\n    foo  deadbeef [bar]\n    foo  deadbeef [bar]\n\nIf you don't have any changes in C:/Dayforce/56, an easy way to\nrecover from the situation is to blast the directory, prune the\nworktree list, and re-create:\n\n    $ rm -rf C:/Dayforce/56\n    $ git worktree prune -v\n    $ git worktree list # just to verify that duplicate entries are gone\n    $ git worktree add C:/Dayforce/56 release/r-856\n\n[1]: https://public-inbox.org/git/20180821193556.GA859@sigill.intra.peff.net/\n[2]: https://public-inbox.org/git/20180828212026.21989-6-sunshine@sunshineco.com/\n"}]}