-
Notifications
You must be signed in to change notification settings - Fork 596
Description
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
- Move the bookmark before committing, which seems a bit weird coming from other VCS
bookmark move -r@-
- Just
jj desc
then bookmark it but then don't forget tojj 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:
- Feedback for the experimental `advance-branches` feature #3549
- Working branches and the JJ "way" #2425
- How bookmarks and Git ought to interact #5333
- FR: Topics (alternative to branches) #3402
- FR:
--advance-branches
flag forjj commit
#2338
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`