Why does git worktree add create a branch, and can I delete it?

后端 未结 6 823
暖寄归人
暖寄归人 2021-02-12 12:08

I used git worktree add to create a new worktree. I noticed that is has created a new branch in the repo with the same name as the worktree. What is this branch for

6条回答
  •  感动是毒
    2021-02-12 12:17

    git worktree --help clearly mentions this as below.

    COMMANDS
           add  []
               Create  and checkout  into it. The new working directory is linked to the current repository, sharing everything
               except working directory specific files such as HEAD, index, etc.
    
               If  is omitted and neither -b nor -B is used, then, as a convenience, a new branch based at HEAD is created automatically,
               as if -b $(basename ) was specified.
    
           prune
               Prune working tree information in $GIT_DIR/worktrees.
    

提交回复
热议问题