How to open a subfolder of a git repo without mounting its parent #112
Unanswered
hellodword
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Hi 👋 Would you be interested in using the VS Code IDE? It will be easier to do with the IDE. In Visual Studio Code, you can open a subfolder of a Git repository without mounting its parent by following these steps:
This will open the subfolder in a new Visual Studio Code window. Note that Git operations will still consider the entire repository, not just the subfolder. This is because Git operates on the level of the entire repository, not individual folders within the repository. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Reproduce:
Get into the devcontainer, you will find not only the subfolder, but also the whole git repo is mounted into the container:
vscode ➜ /workspaces/parent/sub (master) $ ls -al /workspaces/parent/ total 0 drwxr-xr-x 4 vscode users 100 Feb 24 07:46 . drwxr-xr-x 1 root root 12 Feb 24 07:46 .. -rw-r--r-- 1 vscode users 0 Feb 24 07:46 file1 drwxr-xr-x 7 vscode users 200 Feb 24 07:45 .git drwxr-xr-x 3 vscode users 60 Feb 24 07:45 sub
What if I do not want to mount the whole git repo into the devcontainer?
A workaround is doing
git init
in the subfolder, but it's too hacky.Any idea?
Beta Was this translation helpful? Give feedback.
All reactions