git-worktree

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

拈花ヽ惹草 提交于 2019-12-06 03:00:04
问题 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 would end up in a detached HEAD state, but is that so bad, and why can I not even check out the same branch? 回答1: I can see that if I check in from one worktree, the other would end up in a detached HEAD state Actually, it wouldn't , and that's the

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

ぃ、小莉子 提交于 2019-12-05 13:36:47
问题 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 to delete the branch that git worktree add created? 回答1: The branch is necessary because you cannot have the same branch checked out in different worktrees at the same time. So if you do not specify a branch when adding the worktree, then git will

Per-worktree local exclusion

余生颓废 提交于 2019-12-04 10:03:48
I'd like to use local file exclusion on a worktree . I tried adding the file name to .git/worktrees/$worktreename/info/exclude but it doesn't take. The analogous file .git/info/exclude works, but applies to all worktrees, not just the main one. but it doesn't take From this thread , it should, but if you are working with Visual Studio, it does not. Make sure to try with the latest 2.16.x version of Git to see if the issue persists. Note that I do not see an info/exclude in .git/worktrees official layout documentation . A workaround would to have a branch-specific .gitignore content. That means

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

岁酱吖の 提交于 2019-12-04 08:39:35
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 would end up in a detached HEAD state, but is that so bad, and why can I not even check out the same branch? I can see that if I check in from one worktree, the other would end up in a detached HEAD state Actually, it wouldn't , and that's the problem! Each work-tree has its own HEAD , and its own index (aka staging-area or cache). All share the actual

Git add a worktree from existing remote branch

瘦欲@ 提交于 2019-12-03 15:18:22
问题 I'm new to Git. I search a lot but nothing found that exactly matches my case. I have a personal WinForms application and in my remote repo 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 office PC, I add 2 worktree for those north and razavi branches: $ git worktree list C:/Source/nis a6fb6e1 [master] C:/Source/north ebc7670

Git add a worktree from existing remote branch

主宰稳场 提交于 2019-12-03 10:18:49
I'm new to Git. I search a lot but nothing found that exactly matches my case. I have a personal WinForms application and in my remote repo 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 office PC, I add 2 worktree for those north and razavi branches: $ git worktree list C:/Source/nis a6fb6e1 [master] C:/Source/north ebc7670 [north] C:/Source/razavi eed08a2 [razavi] Everything is OK so far, I decide to work on this project from

What goes wrong when using git worktree with git submodules

佐手、 提交于 2019-11-30 05:44:44
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 submodules is incomplete. It is NOT recommended to make multiple checkouts of a superproject. without further explanation as to what goes wrong. Can someone enlighten me about the problems to expect? For example, will I be fine if I use the separate worktrees generated this way only for changes that do not affect the submodules? Commit a83a66a is quite

git-new-workdir: Commit in working tree A causes bogus changes in tree B

独自空忆成欢 提交于 2019-11-29 12:24:42
I use git-new-workdir to have two working trees for one git repository. This usually works very well, but I get funny behaviour after committing something, if the same branch is checked out in both working trees: I start with both working trees clean and on "master". I commit something in working tree A. Result: "git status" in working tree A shows "clean" (as expected) "git status" in working tree B suddenly shows "Changes to be committed" The changes shown are the inverse of the commit I just made in A. For example, if the commit in A added a line, the "Changes to be committed" in B show

What goes wrong when using git worktree with git submodules

徘徊边缘 提交于 2019-11-29 04:57:07
问题 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 submodules is incomplete. It is NOT recommended to make multiple checkouts of a superproject. without further explanation as to what goes wrong. Can someone enlighten me about the problems to expect? For example, will I be fine if I use the separate

git-new-workdir: Commit in working tree A causes bogus changes in tree B

醉酒当歌 提交于 2019-11-28 05:36:50
问题 I use git-new-workdir to have two working trees for one git repository. This usually works very well, but I get funny behaviour after committing something, if the same branch is checked out in both working trees: I start with both working trees clean and on "master". I commit something in working tree A. Result: "git status" in working tree A shows "clean" (as expected) "git status" in working tree B suddenly shows "Changes to be committed" The changes shown are the inverse of the commit I