Skip to content

Commit

Permalink
Document how submodule alternates can be set up (#354)
Browse files Browse the repository at this point in the history
  • Loading branch information
erijo committed Jan 29, 2025
1 parent 4a4f8c4 commit 22b6d19
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions _docs/060_alternates.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,3 +198,32 @@ Configuring Git this way includes `.gitconfig.local` in the standard
`.gitconfig`. yadm will automatically link the correct version based on the
operating system. The bulk of your configurations can go in a single file, and
you just put the exceptions in OS-specific files.

## Submodule alternates

Git submodules can be conditionally enabled using a [conditional git-config
include][git-config-includes] and the `submodule.active`
[configuration][gitsubodules-active].

1. Add the submodule as usual: `yadm submodule add <url> <name>`
2. Add the following to `$HOME/.gitconfig` to include a config only for the
specific repository:

```ini
[includeIf "gitdir:~/.local/share/yadm/repo.git"]
path = .gitconfig.submodules
```
3. Set up `.gitconfig.submodules` to be an alternate or template file that
e.g. contains this on the system where you don't want the submodule checked
out:
```ini
[submodule]
active = *
active = :!<name>
```
4. Run `yadm submodule update` from the [bootstrap](bootstrap) program to check
out all active submodules.
[git-config-includes]: https://git-scm.com/docs/git-config#_conditional_includes
[gitsubodules-active]: https://git-scm.com/docs/gitsubmodules#_active_submodules

0 comments on commit 22b6d19

Please sign in to comment.