Skip to content

Commit cd6ee8b

Browse files
committed
git-push: update documentation of git.push and git push --remote
* remove documented restriction of `git.push` * add examples of providing multiple values. * update `git.push` in config schema * update CHANGELOG Mention the new possible vaulues for `git.push` config and ability to use `--remote` multiple times now, including with string patterns.
1 parent 6c96833 commit cd6ee8b

4 files changed

Lines changed: 26 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
3333
back to prompting the user if the heuristics are inconclusive. It can also run
3434
in non-interactive mode, which aborts if prompting would be needed.
3535

36+
* `jj git push` now supports pushing to multiple remotes at the same time.
37+
This can be configured via `git.push` set to a string pattern
38+
or array of string patterns, or with the repeatable `--remote` flag,
39+
which also accepts string patterns.
40+
3641
### Fixed bugs
3742

3843
* The default pager flags now include `-K` (`--quit-on-intr`), so pressing

cli/src/config-schema.json

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -521,9 +521,19 @@
521521
"default": "none()"
522522
},
523523
"push": {
524-
"type": "string",
525-
"description": "The remote to which commits are pushed",
526-
"default": "origin"
524+
"description": "The remote(s) to which commits are pushed",
525+
"default": "origin",
526+
"oneOf": [
527+
{
528+
"type": "string"
529+
},
530+
{
531+
"type": "array",
532+
"items": {
533+
"type": "string"
534+
}
535+
}
536+
]
527537
},
528538
"record-synthetic-predecessors": {
529539
"type": "boolean",

cli/tests/cli-reference@.md.snap

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
source: cli/tests/test_generate_md_cli_help.rs
33
description: "AUTO-GENERATED FILE, DO NOT EDIT. This cli reference is generated by a test as an `insta` snapshot. MkDocs includes this snapshot from docs/cli-reference.md."
44
---
5+
56
<!-- BEGIN MARKDOWN-->
67

78
# Command-Line Help for `jj`
@@ -1847,9 +1848,13 @@ Before the command actually moves, creates, or deletes a remote bookmark, it mak
18471848

18481849
###### **Options:**
18491850

1850-
* `--remote <REMOTE>` — The remote to push to (only named remotes are supported)
1851+
* `--remote <REMOTE>` — The remote(s) to push to (can be repeated)
18511852

18521853
This defaults to the `git.push` setting. If that is not configured, and if there are multiple remotes, the remote named "origin" will be used.
1854+
1855+
By default, the specified pattern matches remote names with glob syntax, e.g., `--remote '*'`. You can also use other [string pattern syntax].
1856+
1857+
[string pattern syntax]: https://docs.jj-vcs.dev/latest/revsets/#string-patterns
18531858
* `-b`, `--bookmark <BOOKMARK>` — Push only this bookmark, or bookmarks matching a pattern (can be repeated)
18541859

18551860
If a bookmark isn't tracking anything yet, the remote bookmark will be tracked automatically.

docs/config.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1819,12 +1819,10 @@ push to a different remote:
18191819

18201820
```sh
18211821
jj config set --repo git.push "github"
1822+
jj config set --repo git.push "regex:'^(remote|upstream)'"
1823+
jj config set --repo git.push '["remote*", "upstream*"]'
18221824
```
18231825

1824-
Note that unlike `git.fetch`, `git.push` can currently only be a single remote.
1825-
This is not a hard limitation, and could be changed in the future if there is
1826-
demand.
1827-
18281826
### Default bookmarks and tags to fetch
18291827

18301828
You can configure which bookmarks and tags to fetch by default per remote, using

0 commit comments

Comments
 (0)