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

worktree add already exists

From
IWIngo Wolf <ingo.wolf@gmx.de>
Date
May 27, 2019, 15:32 UTC
Message-ID
<ad2ff81a-d75e-1ac4-07d0-c807a2ed9e36@gmx.de>

x@y MINGW64 ~/gittest $ ls bare/  barework/

x@y MINGW64 ~/gittest $ ls -a barework ./  ../  test.txt

x@y MINGW64 ~/gittest
$ git -C bare branch
* master

x@y MINGW64 ~/gittest $ git -C bare worktree add --no-checkout ../barework Preparing worktree (new branch 'barework') fatal: '../barework' already exists

x@y MINGW64 ~/gittest
$ git -C bare branch
   barework
* master

Why this doesn't just work and if not why is barework branch made then, why at all ?

I would like to attach an existing dir to git (make it a workdir) and then update the index with git reset and checkin the differences.

I can do that tricking around with a little dir renaming, new empty dir, move the .git file and rename back...

Next: Eric Sunshine
Message 1 of 7 in “worktree add already exists”
  1. Ingo WolfMay 27, 2019
  2. Eric SunshineJun 2, 2019
  3. Duy NguyenJun 3, 2019
  4. Eric SunshineJun 3, 2019
  5. Duy NguyenJun 5, 2019
  6. Ingo WolfJun 5, 2019
  7. Duy NguyenJun 6, 2019

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.