Skip to content

Commit 99ff6d2

Browse files
committed
document insignore
1 parent 8451c1a commit 99ff6d2

1 file changed

Lines changed: 82 additions & 2 deletions

File tree

‎docs/insdot.md‎

Lines changed: 82 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ This will copy them to the repository. By default, dotfile repositories are
4040
located in `~/.local/share/instant/dots/<repo name>`. You can commit, push and
4141
pull like with normal git repositories because that is what they are.
4242

43+
To recursively add a whole directory, including currently untracked files:
44+
45+
```bash
46+
ins dot add --all .config
47+
```
48+
4349
Once you push new updates to your dotfiles,
4450
```
4551
ins dot update
@@ -68,6 +74,82 @@ only stop if the file is in a state which has never been in the repository, in
6874
which case it is assumed to contain user modifications which should be
6975
preserved.
7076

77+
## `.insignore`
78+
79+
`ins dot add` supports `.insignore` files with the same pattern syntax as
80+
`.gitignore`.
81+
82+
There are two scopes:
83+
84+
- Home-scoped `.insignore` files in your home directory tree control which local
85+
files are eligible to be added.
86+
- Repo-scoped `.insignore` files in the root of a dotfile repository control
87+
which files that repository is willing to accept.
88+
89+
This is mainly useful for files that may exist alongside useful config, but
90+
should never be committed, such as API keys, tokens, machine-local secrets, or
91+
other sensitive state.
92+
93+
### Home-scoped `.insignore`
94+
95+
You can place `.insignore` files anywhere under your home directory. They apply
96+
to that directory and its descendants, and nested `.insignore` files can refine
97+
or override parent rules in the same way you would expect from `.gitignore`
98+
patterns.
99+
100+
Example:
101+
102+
```bash
103+
~/.ssh/.insignore
104+
```
105+
106+
```gitignore
107+
id_ed25519
108+
id_rsa
109+
```
110+
111+
With that file in place:
112+
113+
- `ins dot add --all .ssh` adds the rest of `.ssh`, but skips
114+
`.ssh/id_ed25519` and `.ssh/id_rsa`
115+
- `ins dot add .ssh/id_ed25519` refuses to add the file
116+
- every skipped file is reported in the command output
117+
118+
### Repo-scoped `.insignore`
119+
120+
You can also place a `.insignore` file in the root of a dotfile repository to
121+
prevent that repository from accepting certain files, even if you explicitly try
122+
to add them there.
123+
124+
Example repository root file:
125+
126+
```gitignore
127+
.ssh/id_ed25519
128+
.ssh/id_rsa
129+
```
130+
131+
If that repository is selected as the destination:
132+
133+
- `ins dot add --all .ssh` adds other files in `.ssh`, but skips
134+
`id_ed25519` and `id_rsa`
135+
- `ins dot add .ssh/id_ed25519` refuses to add the file to that repo
136+
- the skip is printed in the output so it is obvious why the file was not added
137+
138+
This is a good safety net for public dotfile repositories where certain files
139+
should never be tracked by accident.
140+
141+
### Forcing an ignored file
142+
143+
Use `--force` to override either kind of `.insignore` rule:
144+
145+
```bash
146+
ins dot add .ssh/id_ed25519 --force
147+
ins dot add --all .ssh --force
148+
```
149+
150+
`--force` only affects the current add operation. It does not change the
151+
contents of any `.insignore` file.
152+
71153

72154
## Interactive menu
73155

@@ -325,5 +407,3 @@ very well by accident.
325407

326408

327409

328-
329-

0 commit comments

Comments
 (0)