You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+23Lines changed: 23 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -182,9 +182,32 @@ git-context remove university
182
182
|`git-context current`| Show active profile |
183
183
|`git-context show <name>`| Show profile details |
184
184
|`git-context remove <name>`| Delete a profile |
185
+
|`git-context dir add <path> <profile>`| Assign a directory to a profile (auto-applied via includeIf) |
186
+
|`git-context dir remove <path>`| Remove a directory assignment |
187
+
|`git-context dir list`| List all directory assignments |
185
188
|`git-context --help`| Show help |
186
189
|`git-context --version`| Show version |
187
190
191
+
### Directory-Based Profiles
192
+
193
+
Assign filesystem paths to profiles so git applies the right identity automatically when you're inside them — no need to remember to `switch`.
194
+
195
+
```bash
196
+
# Make 'work' the default profile (used everywhere unless overridden)
197
+
git-context switch work
198
+
199
+
# Assign specific directories to other profiles
200
+
git-context dir add ~/projects/personal personal
201
+
git-context dir add ~/Mollie work
202
+
203
+
# See all assignments
204
+
git-context dir list
205
+
```
206
+
207
+
Under the hood git-context generates one gitconfig file per profile under `~/.config/git-context/profiles/` and rewrites `~/.gitconfig` as a thin manifest of `[include]` and `[includeIf "gitdir:..."]` blocks that git-context regenerates on every mutating command. The YAML at `~/.config/git-context/config.yaml` is always the source of truth.
208
+
209
+
> Note: git-context owns `~/.gitconfig` end-to-end — don't run `git config --global` directly. Edit the YAML or use the CLI instead.
210
+
188
211
## Configuration
189
212
190
213
The configuration is stored in YAML format at `~/.config/git-context/config.yaml`.
0 commit comments