Skip to content

Commit 0495216

Browse files
committed
docs(cli[add]) Show the remaining add permutations
why: the page documented adding by path and by URL, but --name on a URL that cannot be named, --pin, --shallow, --depth, --yes and --no-merge appeared only as prose, leaving the reader to guess the invocation. what: - Show --name rescuing a URL with no nameable path segment - Add a revision and clone-depth section naming what each flag costs - Show --workspace skipping the root picker, --yes for scripts, and --no-merge leaving repeated roots alone
1 parent c7d3bdf commit 0495216

1 file changed

Lines changed: 60 additions & 1 deletion

File tree

docs/cli/add.md

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,13 @@ isn't the label you want stored in the configuration:
105105
$ vcspull add ~/study/python/pytest-docker --name docker-pytest
106106
```
107107

108+
`--name` is required, rather than optional, when a URL carries no path segment
109+
to name — vcspull stops instead of writing an entry you could not address:
110+
111+
```console
112+
$ vcspull add https://git.example.com/.git --name internal-tools
113+
```
114+
108115
### Override the remote URL
109116

110117
vcspull reads the [Git](https://git-scm.com/) `origin` remote automatically. Supply `--url` when you
@@ -133,6 +140,42 @@ section:
133140
$ vcspull add ~/scratch/tmp-project --workspace ~/projects/python/
134141
```
135142

143+
Naming a workspace also skips the list of declared roots you would otherwise be
144+
offered when adding by URL:
145+
146+
```console
147+
$ vcspull add https://github.com/pallets/flask.git --workspace ~/code/
148+
```
149+
150+
### Record a revision or clone depth
151+
152+
By default an entry tracks its remote's default branch and clones with full
153+
history. Three flags change that, and each one costs you something in exchange.
154+
155+
Pin the entry to a fixed commit, tag, or branch with `--pin`, which records
156+
{ref}`options.rev <config-pin>`. The repository stops following its branch until
157+
you change the pin:
158+
159+
```console
160+
$ vcspull add ~/study/python/flask --pin v3.0.0
161+
```
162+
163+
`--shallow` records `options.shallow: true`, so {ref}`vcspull sync <cli-sync>`
164+
clones with `--depth 1`. That trades git history for disk and time — useful
165+
across many repositories, awkward if you later need `git log` or `git bisect`.
166+
An already-shallow checkout is detected without the flag; this forces it on:
167+
168+
```console
169+
$ vcspull add ~/study/python/django --shallow
170+
```
171+
172+
When depth 1 is too little, `--depth N` keeps a window of history instead.
173+
It overrides `--shallow` when both are given:
174+
175+
```console
176+
$ vcspull add ~/study/python/django --depth 50
177+
```
178+
136179
## Confirmation and dry runs
137180

138181
`vcspull add` asks for confirmation before writing. Use `--yes` to skip the
@@ -146,6 +189,15 @@ $ vcspull add ~/study/python/pytest-docker --dry-run
146189
Dry runs still show duplicate merge diagnostics so you can see what would
147190
change.
148191

192+
`--yes` answers both prompts for you — the confirmation and, when adding by URL,
193+
the workspace-root list — which is what you want from a script:
194+
195+
```console
196+
$ vcspull add https://github.com/pallets/flask.git \
197+
--workspace ~/code/ \
198+
--yes
199+
```
200+
149201
## Choosing configuration files
150202

151203
vcspull searches for configuration files in this order:
@@ -166,7 +218,14 @@ $ vcspull add ~/study/python/pytest-docker \
166218
vcspull merges duplicate workspace sections before writing so existing
167219
repositories stay intact. When it collapses multiple sections, the command logs
168220
a summary of the merge. Prefer to inspect duplicates yourself? Add
169-
`--no-merge` to keep every section untouched.
221+
`--no-merge` to keep every section untouched:
222+
223+
```console
224+
$ vcspull add ~/study/python/pytest-docker --no-merge
225+
```
226+
227+
The entry is still written; only the merging of repeated workspace roots is
228+
skipped, and each duplicate is reported as a warning instead.
170229

171230
## Pinned entries
172231

0 commit comments

Comments
 (0)