I checkout the same git repository multiple times on my machine, and open them on several VSCode instances. I do this because I work on different features/bugs simultaneously on the same repository.
This gets soon confusing which folder I have open, so I want to set a different color theme depending on each folder I open. I can usually do this via settings.json, but since I’m working on the same git repository on all folders, it’ll conflict the settings. There’s user’s settings.json, but this only works globally as far as I know. Is there a solution to this?
3
Answers
I do the following for this:
git add
command.git add .
(which basically adds all changes which is a bad practice we should honestly get rid of) then as mentioned in the comments, run git stash and then commit it.This should help, let me know if something’s missed by me. Thanks.
You could create a multi-root workspace for each checkout / git worktree, make your repo’s root directory one of the root workspace folders of the multi-root workspace, and then set settings in the
.code-workspace
file. This approach has limitations: not all settings are available in the scope for.code-workspace
files (see thescope
section of https://code.visualstudio.com/api/references/contribution-points#Configuration-property-schema). Unfortunately,workbench.colorTheme
is not available for configuration at that scope.Each git worktree may have its own gitignored
.code-workspace
worktree.code-workspace
to.gitignore
and commit it.worktree.code-workspace
in each worktree.johnpapa.vscode-peacock
or whatever VSCode extension to change workspace colors easy..code-workspace
with a bunch of configs and need your worktrees to sync their settings/whatever,git update-index --skip-worktree worktree.code-workspace
. This will break if you change file on upstream, requiring you to manually merge, but will allow downstreaming.code-workspace
changes