From 1ed2ef04058f19c055a03e3a3dea2b932d0bfd91 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 | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/cli/src/commands/git/fetch.rs b/cli/src/commands/git/fetch.rs index f806bb3033..183d3823bc 100644 --- a/cli/src/commands/git/fetch.rs +++ b/cli/src/commands/git/fetch.rs @@ -47,6 +47,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", diff --git a/cli/src/commands/git/push.rs b/cli/src/commands/git/push.rs index c21832f465..e854f3d264 100644 --- a/cli/src/commands/git/push.rs +++ b/cli/src/commands/git/push.rs @@ -78,6 +78,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, add = ArgValueCandidates::new(complete::git_remotes))] 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 aba658a3a3..41b247d87a 100644 --- a/cli/tests/cli-reference@.md.snap +++ b/cli/tests/cli-reference@.md.snap @@ -1099,6 +1099,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 @@ -1159,6 +1161,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.