threads / discuss / 58221

How to specify a remote branch in git worktree?

Subject: How to specify a remote branch in git worktree?

## tl;dr

2 messages between Jul 25, 2022 and Jul 25, 2022.

replies: 1people: 1as markdown or json

Elie Obeid· Jul 25, 2022, 20:51 UTC · lore

Hi, I have two remote branches prod and beta, I want to create one worktree for prod and one for beta.

mkdir app && cd app git clone --bare repo .git git worktree add --checkout beta beta git worktree add --checkout prod prod cd prod git pull Mege conflict

As you can see, I get a merge conflict right after I clone the repo, create the worktree and do a git pull, maybe the worktree is trying to do a pull from master, I have no idea How to fix that?

Best Regards.
Elie Obeid· Jul 25, 2022, 21:07 UTC · re: Elie Obeid · lore

Re: How to specify a remote branch in git worktree?

The regular clone (without using --bare), works excellently, with no issues, I just tested it, added workspaces and all is fine.

Best Regards.
On Tue, Jul 26, 2022 at 12:51 AM Elie Obeid <elieobeid7@gmail.com> wrote:
Show 22 quoted lines
>
> Hi, I have two remote branches prod and beta, I want to create one
> worktree for prod and one for beta.
>
>
> mkdir app && cd app
> git clone --bare repo .git
> git worktree add --checkout beta beta
> git worktree add --checkout prod prod
> cd prod
> git pull
> Mege conflict
>
>
>
> As you can see, I get a merge conflict  right after I clone the repo,
> create  the worktree and do a git pull, maybe the worktree is trying
> to do a pull from master, I have no idea
> How to fix that?
>
>
> Best Regards.

← back to recent threads