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

Re: bugreport: "git checkout -B" allows checking out one branch across multiple worktrees

From
JJJinwook Jeong <vustthat@gmail.com>
Date
Jan 16, 2023, 02:50 UTC
Message-ID
<CAA3Q-aazO1ko4uBSUs5W_rjn8AP_=fc2jAYrMsaeMtpnm54ExA@mail.gmail.com>
In-Reply-To
<20230116001144.dt76xk6hkwn45klz@Carlos-MacBook-Pro-2.local>

On Mon, Jan 16, 2023 at 9:11 AM Carlo Marcelo Arenas Belón <carenas@gmail.com> wrote:

Show 13 quoted lines
>
> On Sat, Jan 14, 2023 at 06:45:34PM +0900, Jinwook Jeong wrote:
> > What did you do before the bug happened? (Steps to reproduce your issue)
> >
> > 1. `cd` into any git repo that has at least one commit.
> > 2. Identify the current branch, say main
> > 3. $ git branch foo # a new branch
> > 4. $ git worktree add ../new_worktree foo
> > 5. $ cd ../new_worktree
> > 6. $ git checkout -B master HEAD
>
> Was your intention to get this worktree's content back to what is in
> master's HEAD?, then the command should had been

Sorry for confusion. These steps didn't reflect my real use case but rather are for demonstration.

I encountered this issue by chance, not knowing how that command would work under multiple worktrees.

Previous: Eric Sunshine
Message 4 of 4 in “bugreport: "git checkout -B" allows checking out one branch across multiple worktrees”
  1. Jinwook JeongJan 14, 2023
  2. Carlo Marcelo Arenas BelónJan 16, 2023
  3. Eric SunshineJan 16, 2023
  4. Jinwook JeongJan 16, 2023

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.