Find the closest bookmark in history to advance it forward #5568
Replies: 5 comments 18 replies
-
|
The revset to find the commit with the bookmark closest to Some people in the jj community have an alias they call [revset-aliases]
'closest_bookmark(to)' = 'heads(::to & bookmarks())'
[aliases]
tug = ["bookmark", "move", "--from", "closest_bookmark(@-)", "--to", "@-"]Usage: $ jj new my-feature
# work work work
$ jj commit -m "Add some changes"
$ jj tug
# The bookmark my-feature is now at @-If you want to move the bookmark to |
Beta Was this translation helpful? Give feedback.
-
|
Read about the |
Beta Was this translation helpful? Give feedback.
-
|
A slightly modified version that also works with the edit workflow: [revset-aliases]
'closest_bookmark(to)' = 'heads(::to & bookmarks())'
'closest_pushable(to)' = 'heads(::to & ~description(exact:"") & (~empty() | merges()))'
[aliases]
tug = ["bookmark", "move", "--from", "closest_bookmark(@)", "--to", "closest_pushable(@)"]Instead of moving the bookmark to the commit before the working copy, it moves the bookmark to the closest commit with a description that is either not empty or a merge. |
Beta Was this translation helpful? Give feedback.
-
|
I'm trying to adapt some of the discussion here and at #6832 My goal is to select single closest bookmark for my prompt: It seems a bunch of issues stem from two problems:
https://jj-vcs.github.io/jj/latest/templates/#global-functions suggests that As a workaround, I can try to use Is there a way to get the first element of a |
Beta Was this translation helpful? Give feedback.
-
|
I'm doing this a bit differently using a script: JJ_TUG.PS1 Doing it like this, a target revision can be specified (defaulting to @) and it won't move multiple bookmarks as "heads(::@ & bookmarks())" might in a environment where merging branches is common. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
When appending a new commit to a branch using
jj commit, I need to find the "closest" bookmark to move it forward. Is there a shorter way to do this besidesjj bookmark set my-bookmark -r @-?Beta Was this translation helpful? Give feedback.
All reactions