-
Notifications
You must be signed in to change notification settings - Fork 29.4k
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 for gitdir #77215
Comments
Oh, and I can't see any gutters for files tracked in |
Worktree support: #68038 |
Workaround for anyone else arriving from #80946: alias dotfiles='GIT_DIR=$DOTFILES_REPO GIT_WORK_TREE=~'
dotfiles git status
dotfiles code ~ |
- The alias has been changed in order to support opening the git bare repo from vs code - Source: microsoft/vscode#77215 (comment)
- The alias has been changed in order to support opening the git bare repo from vs code - Source: microsoft/vscode#77215 (comment)
@lszomoru Look forward to your fix! 🤞🏻 |
Does anybody know how to make this work for $SHELL=usr/bin/fish? @faho Previously I had
But I tried to modify it without specifying an application and it didn't work. |
https://fishshell.com/docs/2.2/faq.html#faq-single-env
|
vscode - The alias has been changed in order to support opening the git bare repo from vs code - Source: microsoft/vscode#77215 (comment)
@RyzeNGrind - This is how you'd do the same in Fish: function dotfiles --description "dotfiles commands with bare git repo"
GIT_WORK_TREE=~ GIT_DIR=~/.dotfiles $argv
end Then run |
What is the expected behavior when specifying two different I arrived here looking for similar functionality, to specify a single non-standard Launching vscode from the command line with a different environment variable is not an effective solution when I need to have multiple projects open with different settings. |
@sparr I you look at $ # regular dotfiles
$ GIT_WORK_TREE=~ GIT_DIR=~/.dotfiles code --new-window
$ # private dotfiles
$ GIT_WORK_TREE=~ GIT_DIR=~/.dotfiles.local code --new-window Each running instance of VS Code will then have its own If you find that VS Code is reusing a running instance, you may also find it helpful to check your new window settings. |
Ping @lszomoru if you have any insight about planning etc. 🛎️ |
Another problem with the $GIT_DIR approach is that it breaks workflows that interact with other git repositories. I need vscode's extensions and behavior to honor the gitdir associated with my workspace, but the terminal to behave normally so I can perform git operations in other repositories (such as submodules). I might be able to accomplish this by unsetting $GIT_DIR in each terminal I open, but that seems hack-y. |
@sparr Check out terminal profiles. You can either unset the variable or disable inheritance altogether. |
how to do it in ssh environment ? |
@texastoland I don't think that's relevant to changing the behavior of the non-terminal parts of vscode, such as the built in |
I use two git repositories within project folder - one is
.git
and second is.git_dev
. First is for project and second is to track my local config files. I used to work with second via aliasgit dev
which stands forgit --git-dir=.git_dev
, but for now I explore ways to list changes within both repos in git sideview.What I did:
project
) and call itproject_dev
git init --separate-git-dir ../project/.git_dev
. It creates fileproject_dev/.git
with related line.project_dev
folder and open it in Code. Now I'm able to view changes for both repos, but one calledproject_dev
tracks theproject_dev
folder, not theproject
worktree=/path/to/project
in.git_dev/cofig
. Now git sideview perfectly represents current changes forproject_dev
aside to mainproject
.And here I run into two issues:
project_dev
section of sideview, an error occurs with message:Unable to open 'filename (Working Tree)': Unable to read file (Error: File not found (/path/to/project_dev/filename)).
like it doen't respect settingworktree
at all.project_dev
folder, second repo is not shown. If I removeworktree
setting,project_dev
repo is shown again and I have to addworktree
setting again to get changes properly.Example repo:
https://github.com/deitry/vscode-two-git-repos-issues
So, on the one hand I consider current behaviour as buggy. On the other hand, I make a request to add option to pass as many
--git-dir
s as I want by making it a list:The text was updated successfully, but these errors were encountered: