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

git rebase allows branches to be checked out in multiple worktrees

From
Mike Hommey <mh@glandium.org>
Date
Feb 20, 2020, 00:29 UTC
Message-ID
<20200220002932.5jws6qpnivlvxckw@glandium.org>
Hi,

I just noticed a quirk with git rebase vs. worktrees. While using e.g. git checkout will prevent a same branch from being checked out from multiple worktrees, that's not the case for git-rebase, so the following scenario ends up with two checkouts of the same branch:

$ git checkout -b foo HEAD~ $ git commit --allow-empty -m foo $ git worktree add /tmp/bar master $ cd /tmp/bar $ git rebase master foo

Mike
Next: Eric Sunshine
Message 1 of 5 in “git rebase allows branches to be checked out in multiple worktrees”
  1. Mike HommeyFeb 20, 2020
  2. 0/2 git-rebase: refuse to switch to branch checked out elsewhereEric Sunshine, Feb 23, 2020
  3. 1/2 t3400: make test clean up after itselfEric Sunshine, Feb 23, 2020
  4. Eric SunshineFeb 24, 2020
  5. 2/2 rebase: refuse to switch to branch already checked out elsewhereEric Sunshine, Feb 23, 2020

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.