Web lists-archives.com

worktree add already exists





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...