Skip to content

Commit

Permalink
cli: git: document about default fetch/push --remote
Browse files Browse the repository at this point in the history
  • Loading branch information
yuja committed Nov 15, 2024
1 parent 7ed829e commit 1ed2ef0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cli/src/commands/git/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ pub struct GitFetchArgs {
branch: Vec<StringPattern>,
/// 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",
Expand Down
5 changes: 5 additions & 0 deletions cli/src/commands/git/push.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
/// Push only this bookmark, or bookmarks matching a pattern (can be
Expand Down
4 changes: 4 additions & 0 deletions cli/tests/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -1099,6 +1099,8 @@ If a working-copy commit gets abandoned, it will be given a new, empty commit. T
Default value: `glob:*`
* `--remote <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
Expand Down Expand Up @@ -1159,6 +1161,8 @@ Before the command actually moves, creates, or deletes a remote bookmark, it mak
###### **Options:**
* `--remote <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 <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.
Expand Down

0 comments on commit 1ed2ef0

Please sign in to comment.