|
|
|
|
|
by lowboy
232 days ago
|
|
If you're looking to model git branches as much as possible with jj bookmarks and assume that: - the working copy has a bookmark pointing to it - there's some ancestor with a bookmark - there's a single linear path between the two with no other bookmarks in between Here's an example that represents a branch containing 3 commits named "bookmark-05ff" branched off of "bookmark-6825". > jj log -r y:: -T builtin_log_redacted
@ urplyywu user-482a 2025-10-23 13:24:52 bookmark-05ff a334e2e1
│ (empty) (redacted)
○ lxxtnlxw user-482a 2025-10-23 13:24:46 git_head() 7e32fa6b
│ (empty) (redacted)
○ omktyuos user-482a 2025-10-23 13:24:13 7668b0bb
│ (empty) (redacted)
○ ykzktoux user-7b7f 2025-10-23 13:23:47 bookmark-6825 98bfcbde
│ (empty) (redacted)
~
In this case, the following log would get you the commit pointed to by "bookmark-6825": > jj log -r 'latest(ancestors(@) & bookmarks(), 2) ~ @' -T builtin_log_redacted
○ ykzktoux user-7b7f 2025-10-23 13:23:47 bookmark-6825 98bfcbde
│ (empty) (redacted)
~
I'm using the builtin_log_redacted output template. Normally you'd have actual bookmark names, descriptions, user, etc.Also note this bakes in a lot of assumptions and is brittle. As many others have said, it’s not generalizable. |
|