git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Able to checkout same branch in multiple worktrees when using symbolic-refs
@ 2022-04-29 19:05 Austin Morton
  2022-04-29 20:19 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Austin Morton @ 2022-04-29 19:05 UTC (permalink / raw)
  To: git

Hello,

When using a symbolic-ref I am able to inadvertently checkout the same
branch in multiple worktrees when using the symbolic-ref name, despite
being prevented from doing so if I use the target branch name.

Below is a minimal reproducer:

$ git --version
git version 2.36.0
$ git init .
$ git status
$ git commit --allow-empty -m "Initial commit"
$ git symbolic-ref refs/heads/main refs/heads/master
$ git worktree add ../worktree2
$ git worktree list
/home/amorton/test/worktree1 cd8312d [master]
/home/amorton/test/worktree2 cd8312d [worktree2]
$ cd ../worktree2
$ git checkout master
fatal: 'master' is already checked out at '/home/amorton/test/worktree1'
$ git checkout main
Switched to branch 'main'
$ git worktree list
/home/amorton/test/worktree1 cd8312d [master]
/home/amorton/test/worktree2 cd8312d [master]


-- 
Austin Morton
austin.morton@aquatic.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-05-02 18:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-29 19:05 Able to checkout same branch in multiple worktrees when using symbolic-refs Austin Morton
2022-04-29 20:19 ` Junio C Hamano
2022-05-02 14:54   ` Austin Morton
2022-05-02 18:30     ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).