Skip to content

FR: Convenient names for changes #3482

@matts1

Description

@matts1

Is your feature request related to a problem? Please describe.
There are two related problems here that this FR is designed to solve:

  1. Naming local commits - it becomes very annoying to remember change IDs and/or revsets, and so if you name commits it can be a lot easier to write jj new <alias>
  2. Identifying commits for the purposes of patch-based workflows. In a patch-based workflow such as internally at google, or gerrit, it'd be useful to be able to see in my jj log entries such as:
@  vzokzlpu msta 5 days ago crrev.com/c/5439098 a2016214
│ Commit description here

Similarly, it'd be nice to be able to write crrev.com/c/5439098

Describe the solution you'd like
I'd like to add a command jj alias. This would be almost the same command as jj branch - it would have the following subcommands:

  • jj alias add <revision> <alias> --force
    • --force would move the alias to here even if it was previously defined elsewhere
  • jj alias remove <alias>

Aliases would be associated with a change, and thus would persist across rewrites. The main distinction between aliases and branches are that:

  • They would not be represented in git
  • When you drop the commit, the alias would disappear too, rather than propogating to the parent

Similar to branches, you could write jj alias add @- foo, then later run jj new foo

Describe alternatives you've considered
Branches
When I asked about this earlier, branches are the currently recommended solution for such an approach. However, the problem is that a branch is not associated with a particular change. Consider:

◉  pvlpykyo msta 5 days ago foo 13bbdfc2
│  My local commit
◉  vzokzlpu msta 5 days ago main a2016214
│  immutable head here

If I were to write jj abandon foo, then the branch foo would instead move to main. The same thing would happen if I were to submit foo, then later run jj rebase --skip-empty.

Tags:
I considered just using git tags for this, and just calling them tags, but @martinvonz pointed out that might be confusing since tags are associated with a commit, rather than a change.

Additional context
Add any other context or screenshots about the feature request here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions