From 377c3b58839964004720e42aef7cdd03c221e07a Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Mon, 28 Oct 2024 17:43:16 +0900 Subject: [PATCH] cli: git: document about default fetch/push --remote --- cli/src/commands/git/fetch.rs | 3 +++ cli/src/commands/git/push.rs | 5 +++++ cli/tests/cli-reference@.md.snap | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/cli/src/commands/git/fetch.rs b/cli/src/commands/git/fetch.rs index 8413895072a..d4375dd70e4 100644 --- a/cli/src/commands/git/fetch.rs +++ b/cli/src/commands/git/fetch.rs @@ -46,6 +46,9 @@ pub struct GitFetchArgs { branch: Vec, /// The remote to fetch from (only named remotes are supported, can be /// repeated) + /// + /// This defaults to the `git.fetch` setting. If that is not configured, and + /// if there are multiple remotes, the remote named "origin" will be used. #[arg(long = "remote", value_name = "REMOTE")] remotes: Vec, /// Fetch from all remotes diff --git a/cli/src/commands/git/push.rs b/cli/src/commands/git/push.rs index b95d3b2ff76..45e956eb5fd 100644 --- a/cli/src/commands/git/push.rs +++ b/cli/src/commands/git/push.rs @@ -76,6 +76,11 @@ use crate::ui::Ui; #[command(group(ArgGroup::new("what").args(&["all", "deleted", "tracked"]).conflicts_with("specific")))] pub struct GitPushArgs { /// The remote to push to (only named remotes are supported) + /// + /// 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. + /// Unlike in Git, the default remote is not derived from the tracked remote + /// bookmarks. #[arg(long)] remote: Option, /// Push only this bookmark, or bookmarks matching a pattern (can be diff --git a/cli/tests/cli-reference@.md.snap b/cli/tests/cli-reference@.md.snap index 3a3f4f788e0..316eb04497c 100644 --- a/cli/tests/cli-reference@.md.snap +++ b/cli/tests/cli-reference@.md.snap @@ -1,6 +1,7 @@ --- source: cli/tests/test_generate_md_cli_help.rs 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." +snapshot_kind: text --- @@ -1056,6 +1057,8 @@ If a working-copy commit gets abandoned, it will be given a new, empty commit. T Default value: `glob:*` * `--remote ` — The remote to fetch from (only named remotes are supported, can be repeated) + + This defaults to the `git.fetch` setting. If that is not configured, and if there are multiple remotes, the remote named "origin" will be used. * `--all-remotes` — Fetch from all remotes @@ -1116,6 +1119,8 @@ Before the command actually moves, creates, or deletes a remote bookmark, it mak ###### **Options:** * `--remote ` — The remote to push to (only named remotes are supported) + + 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. Unlike in Git, the default remote is not derived from the tracked remote bookmarks. * `-b`, `--bookmark ` — Push only this bookmark, or bookmarks matching a pattern (can be repeated) By default, the specified name matches exactly. Use `glob:` prefix to select bookmarks by wildcard pattern. For details, see https://martinvonz.github.io/jj/latest/revsets#string-patterns.