Skip to content

Warn/require confirmation on bookmarking empty changes? #5374

@drieber

Description

@drieber

Discussed in #5363

Originally posted by sourcefrog January 14, 2025
In getting to know jj, when I am working on a feature branch that I want to push to github, I've fairly often run a flow like

jj commit -m Whatever
jj bookmark move featurebranch

The trap of course is that the bookmark is set to the new empty revision following the thing that I committed. I suppose pushing the empty rev to a feature branch on github is not too harmful but it does seem a bit messy.

The right answer I guess is that I should either

  1. Move the bookmark before committing, which seems a bit weird coming from other VCS
  2. bookmark move -r@-
  3. Just jj desc then bookmark it but then don't forget to jj new

I see there is a good bit of existing discussion about various types of auto-moving bookmarks, which would perhaps be a more fundamental answer for this kind of workflow:

As a more concrete and tactical (perhaps excessively tactical) fix I wonder if the UI should by default prevent moving a bookmark to an empty change, the same way it by default prevents you pushing new bookmarks and moving bookmarks backwards.

That is, jj new; jj bookmark set bbb would fail unless you said --allow-empty.

Alternatively, rather than failing it could say

warning: bookmark bbb is set to an empty revision
hint: to set it to the parent revision use `jj bookmark move bbb -rrstuvwxyz --allow-backwards`

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions