Git: Support for gitdir
See original GitHub issueI 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 alias git dev
which stands for git --git-dir=.git_dev
, but for now I explore ways to list changes within both repos in git sideview.
What I did:
- I create folder aside the main project folder(consider it
project
) and call itproject_dev
- Initialize new repo in new folder with
git init --separate-git-dir ../project/.git_dev
. It creates fileproject_dev/.git
with related line. - Then create new file within
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
- So my next step is to add setting
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:
- if I try to click on changed file in
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. - If I reload Code, even if I open file from
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:
"git.gitdirs: [ ".git", ".git_dev"]
Issue Analytics
- State:
- Created 4 years ago
- Reactions:19
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Git - git Documentation - Git SCM
You can learn more about individual Git commands with "git help command". ... (or GIT_DIR environment variable) turns off the repository discovery that ......
Read more >`dir` vs `gitdir` - isomorphic-git
If you have a non-bare git repository, there are two parts to it: the git directory ... The isomorphic-git equivalent of --git-dir is...
Read more >git with --git-dir= results in 'not a git repository' - Stack Overflow
To help me remember what to do, I try to remember that the option is asking for exactly what it wants: the path...
Read more >assistant does not support nonstandard --git-dir - git-annex
Please describe the problem. If using git annex with external .git dir webapp report a tread crashed and ever trying to restart it...
Read more >Git Directory and Work-Tree Explained - jdhao
Git has two option --git-dir and --work-tree. What is the use for them?
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Workaround for anyone else arriving from #80946:
@lszomoru Look forward to your fix! 🤞🏻