-
Notifications
You must be signed in to change notification settings - Fork 30.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Git - Support git worktrees in workspace #68038
Comments
(Experimental duplicate detection) |
Thank you honorable vscodebot, but this feature request is not a duplicate of that issue. |
i just tested this out and it looks to be fixed now on v1.35.0 @colemickens is this still an issue for you? |
In current version 1.40.2 I can see the multiple source control providers only when the root does not contain a .git and is initialized by the command 'Git: Initialize Repository'. |
I am facing a similar issue, any updates here? |
Is someone working on this? Need the worktree support |
any update on this? how I can use worktree while using vscode? |
I don't know why this keeps getting comments, afaict vs code supports work trees just fine these days. |
How can VSCode handle the scenario described above? For clarity, the issue is about
I think the key point of this issue is this. I would also be interested in these kind of quickly cloned workspaces. |
What's missing here is the ability to switch between branches and/or create a new worktree when working in a bare repo. The branch listing works just fine but vscode doesn't automatically change the working directories when I select a branch that exists as a worktree. |
The worktree support also doesn't work if the worktree is located in another path, e.g.:
and opening project and project2 in separate VS Code workspaces, only project will see the repo, not project2. |
As an example, the Gitlens repo might be a good place to start as they have this included in their extension but behind a paywall. I'm not sure how they are handling something like a |
Not with devcontainers. |
EDIT: I checked if I had the upstream set, which I didn't, whoops, but it seems that it's still the same result. I have a setup where I have this folder with a bare-cloned repository and have worktrees for each branches I work on, for some reason it thinks all of my branches are unpublished, which it isn't the case.
|
@joaomoreno , @lszomoru . I think that pasting the images in this issues is better then creating a new one. |
@intrnl Can you share what you did to verify and set upstream? I feel kinda dumb cause apparently what I've done just isn't correct. I've got a very similar structure and am seeing this same behavior. |
There are workarounds for the Dev Container issue, like:
Alternatively I think it might work also to add/mount the main git for the worktrees, in the same relative position, using a docker-compose.yaml file and consume it in devcontrainer config. Did not test this myself yet. |
I have an alternative solution that goes like this:
here's my fish script for reference # file: ~/.config/fish/functions/gcb.fish
function gcb --description 'Clones a repo as bare and set up two worktrees.'
set repo "$argv[1]"
set dir "$argv[2]"
if test -z $dir
set dir (echo "$repo" | grep -o '[^/]*$')
end
set proj_name (string join . (string split . "$dir")[1..-2])
git clone --single-branch --bare "$repo" "$dir"
cd "$dir"
git fetch --all --prune
git config --local --add remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
git worktree add -b rename1 wt/1/$proj_name
git worktree add -b rename2 wt/2/$proj_name
cd wt/1/$proj_name
end In the end I would do something like gcb git@github.com:microsoft/vscode.git && code . Hope it helps. |
I'm having a similar issue. |
Scenario:
repro
directory in VS CodeExpected: "Source Control Providers" lists Git repos.
example1
example1branchA
example1branchB
example2
Actual: "Source Control Providers" lists Git repos.
example1
example2
I sometimes will have lots of branches checked out in parallel on huge repos that I can't afford to clone multiple times. I would also like to be able to use VS Code's source control functionality with these checkouts all the same.
Thanks! and thanks for Code!
The text was updated successfully, but these errors were encountered: