Skip to content

FR: Pushing and fetching arbitrary refs #4388

Description

@ilyagr

Is your feature request related to a problem? Please describe.
Currently, there is no way to use jj to push or fetch an arbitrary ref from the remote. This causes problems for e.g. Gerrit as discussed on Discord.

On one hand, this reinforces the desire for Gerrit support, #4387, but separately it would be nice to support something for the general case.

Describe the solution you'd like
I can think of 2 possible solutions:

  1. Re-design our branches (soon to be called bookmarks) to support tracking an arbitrary ref on a remote. This probably would imply having to support tracking different refs on different remotes, tracking remote branches of a different name, and perhaps tracking multiple refs per remote.
  2. Set up simple commands to push and fetch arbitrary refs unsafely, either permanently or until we can implement 1 or think of a better solution.

Here's a possible interface for option 2. It's different enough from regular fetch/push that I think it deserves separate commands:

  • jj git fetch-ref [--remote REMOTE] REF_NAME [branch_name] would fetch an arbitrary ref and optionally create a branch at the newly fetched commit for easier reference later. This new local branch wouldn't track anything. It'd just be a bookmark :).
  • jj git push-ref <--force|--expected-at COMMIT_ID> [--remote REMOTE] REVISION REF_NAME

Both 1 and 2 have disadvantages. 1 adds complexity to the UI and the model. I'm not sure whether or not 2. is better than telling people to co-locate the repo and use git fetch/git push.

In any case, I'm curious what people think should be done here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    polish🪒🐃Make existing features more convenient and more consistent

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions