Skip to content

Commit

Permalink
git: allow both --branch/--bookmark for git fetch/push
Browse files Browse the repository at this point in the history
`jj git push` has a `--bookmark` argument, which takes a list of
bookmarks to push to the Git remote. They'll become branches on the
Git remote. `jj git fetch` has a `--branch` argument, which takes a
list of Git branches to fetch. They'll become bookmarks once
fetched. So the naming is consistent, but the reasoning is quite
subtle. Let's provide the other name as a hidden alias to help users
who get it wrong.
  • Loading branch information
martinvonz committed Oct 7, 2024
1 parent 24ff802 commit 4db5995
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cli/src/commands/git/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub struct GitFetchArgs {
///
/// By default, the specified name matches exactly. Use `glob:` prefix to
/// expand `*` as a glob. The other wildcard characters aren't supported.
#[arg(long, short, default_value = "glob:*", value_parser = StringPattern::parse)]
#[arg(long, short, alias="bookmark", default_value = "glob:*", value_parser = StringPattern::parse)]
branch: Vec<StringPattern>,
/// The remote to fetch from (only named remotes are supported, can be
/// repeated)
Expand Down
2 changes: 1 addition & 1 deletion cli/src/commands/git/push.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ pub struct GitPushArgs {
/// 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.
#[arg(long, short, value_parser = StringPattern::parse)]
#[arg(long, short, alias="branch", value_parser = StringPattern::parse)]
bookmark: Vec<StringPattern>,
/// Push all bookmarks (including deleted bookmarks)
#[arg(long)]
Expand Down

0 comments on commit 4db5995

Please sign in to comment.