Questions tagged [git-worktree]

Questions regarding using the worktree feature of GIT (Command: git worktree). Worktrees allow you to checkout more than one branch at any one time.

Questions regarding using the worktree feature of GIT (Command: git worktree). Worktrees allow you to checkout more than one branch at any one time. See https://git-scm.com/docs/git-worktree for more information.

134 questions
321
votes
12 answers

What would I use git-worktree for?

I read Github's post on git-worktree. They write: Suppose you're working in a Git repository on a branch called feature, when a user reports a high-urgency bug in master. First you create a linked working tree with a new branch, hotfix, checked out…
awendt
  • 13,195
  • 5
  • 48
  • 66
69
votes
5 answers

Git add a worktree from existing remote branch

In my remote repository there are 3 branches (master and 2 long running branches): master #the common features are here like Core, DAL,... north #customized for A company (long-running) razavi #customized for B company (long-running) At my…
vaheeds
  • 2,594
  • 4
  • 26
  • 36
64
votes
1 answer

What goes wrong when using git worktree with git submodules

I recently discovered the git worktree command: The new working directory is linked to the current repository, sharing everything except working directory specific files such as HEAD, index, etc. But the docs also indicate … the support for…
Joachim Breitner
  • 25,395
  • 6
  • 78
  • 139
58
votes
8 answers

'' is already checked out at '' in git worktrees

I started using git worktrees. It seems to work, but I'm getting this error when attempting to check out a branch in the cloned worktree: fatal: '' is already checked out at '' How do I get around this without deleting the…
Harald Nordgren
  • 11,693
  • 6
  • 41
  • 65
49
votes
4 answers

Not able to checkout branch even after removing worktree and running worktree prune

I create a worktree for branch using the following command: Git add worktree This created a new worktree for me and checked out the branch at the path Now I thought of deleting/removing the worktree. Ran following…
Randeep Singh
  • 1,275
  • 14
  • 29
31
votes
6 answers

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

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? I have checked out an other, pre-existing branch in the second worktree. Am I free…
Tor Klingberg
  • 4,790
  • 6
  • 41
  • 51
29
votes
4 answers

Git workflow - changing branch and slow recompiles

I work on a large Scala project where we use Git for version control. My workflow is to work on new features in my own branch and switch when needed. Various releases of the code are in their own branches. All very standard. If I have to fix a bug…
David
  • 1,862
  • 2
  • 22
  • 35
16
votes
1 answer

Why can two git worktrees not check out the same branch?

Using a separate git-worktree, why can I not check out the same branch as in the main working copy? If I try, I get the error: fatal: 'mybranch' is already checked out at '/path/to/repo' I can see that if I check in from one worktree, the other…
Tor Klingberg
  • 4,790
  • 6
  • 41
  • 51
16
votes
2 answers

How do I use git worktrees in IntelliJ IDEA 2016.1?

The newest version of IntelliJ says it has support for git worktrees, but I can't seem to find anywhere that says how to use it. I was expecting to see an entry in the Git Branches popup in the lower right, but I don't see it there. I also don't see…
DanTilkin
  • 263
  • 2
  • 8
14
votes
2 answers

Git - Bare repo cannot have a worktree for master branch - WHY?

I'm working on some server-side software to do a merge. By using git worktree it's possible to check out a given branch for a bare repo and merge another branch into it. It's very fast, even with large repositories. The only exception seems to be…
mtutty
  • 815
  • 2
  • 10
  • 22
12
votes
1 answer

How can I rename a git worktree

Given I have run $ git worktree add ~/worktrees/a $ cd ~/worktrees/a $ git status On branch a I would like to instead change the name of the worktree and branch from a to b.
jlhasson
  • 1,516
  • 1
  • 15
  • 23
12
votes
1 answer

How to use Git worktrees with Eclipse IDE?

I am moving a large application from SVN to Git while only having read "pro Git" and some worktree details online and played around with Git. I created a single repository that manages the code of my application. My application consits of a lot of…
Martin
  • 607
  • 1
  • 8
  • 17
11
votes
5 answers

git worktree with relative path?

I have a master and a setup branch in my repo. I'm keeping the setup branch checked out as a worktree inside the main repo folder via git worktree add ./local/setup echo '/local' > .gitignore So the main repo folder is on master, and the…
usretc
  • 723
  • 4
  • 9
10
votes
4 answers

git bare repositories, worktrees and tracking branches

I'm working with a code base where I need to be working on several branches at once for different purposes. So I clone to a bare repository and then set up some worktrees: git clone --bare ssh://git@git.example.com/project/repo repo.git cd…
Tom
  • 7,269
  • 1
  • 42
  • 69
9
votes
3 answers

what does "git config core.worktree" mean?

I have seen this line in a script I am using : git config core.worktree .. I'm not sure what does git worktree do, but I definitively do not understand why to set it to .. Any clue ? Thanks
flod
  • 235
  • 4
  • 12
1
2 3
8 9