You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I hadn't realised that jj absorb looks for changes at line-level, rather than file-level.
Keeping this open to see if there is appetite for a flag along the lines of --granularity=file, with --granularity=line being the default behaviour. Or perhaps jj absorb could simply fall back to absorbing into the same file if there are no line-level matches?
I appreciate I can do this manually with jj squash, but jj absorb is a lot more convenient!
Original Post
Apologies if PEBCAK and not a bug, but I assumed this would work based on the description of jj absorb...
I can't share the exact commits and repository as they're private, but I'll describe the state of things.
I'm working on a feature, based off my colleague's branch, as follows:
@ psswxrxt [email protected] 2025-02-14 19:23:23 4fbbb337
│ (no description set)
○ wootuxwm [email protected] 2025-02-14 19:04:11 example/my-branch git_head() 7592656d
│ add brand new code in new directory
○ vzrmlxxs [email protected] 2025-02-14 19:04:11 7f69a590
│ update colleague's changes in directory `foo/`
○ nlznywlw [email protected] 2025-02-11 17:37:02 example/colleague-branch 753008a0
│ add some more changes in directory `foo/`
○ qyrunlwq [email protected] 2025-02-11 17:35:27 38bc805d
│ add some changes
◆ ztxrpqqt [email protected] 2025-02-10 19:39:01 main df397142
│ init
~
I've made some changes in @ that modify files in foo/ (most recent change modifying these files was in vzrmlxxs). Now, both my colleague and myself have made changes in these files.
If I run jj absorb with no arguments, the output is:
Absorbed changes into these revisions:
qyrunlwq 3c3cf48f add some changes
Rebased 3 descendant commits.
Working copy now at: onsmswty 2740eb3e (empty) (no description set)
Parent commit : wootuxwm 7592656d example/my-branch* | add brand new code in new directory
This is what I would expect.
However, I don't want to modify my colleague's changes. Instead, I want to absorb into my own previous changes, so I run jj absorb --into='mutable() & mine()', and the output is:
Nothing changed.
Why is jj not absorbing the changes into my previous change (vzrmlxxs) when I limit the revisions in this way, but is happy to modify my colleague's changes?
The text was updated successfully, but these errors were encountered:
jj absorb will absorb into the closest commit that modified the same line. Maybe your commit didn't modify the same line? What does jj file annotate say about it?
Aha, that's the part I missed - modifying the same line! I didn't realise it was that fine-grained. I modified elsewhere in the file.
It would be neat if there was a flag/config option (e.g. --granularity=line|file) to operate at the file level, rather than the line level, even if the default is line.
Is this a feature you might consider adding? If so, would you like me to raise a new issue for it, or shall we track it here?
zx8
changed the title
jj absorb is not squashing my changes as expectedjj absorb is not squashing my file-level changes as expected
Feb 14, 2025
@yuja As the original author of jj absorb, what are your thoughts here? I'm currently working around this by either jj squash'ing manually, or adding arbitrary whitespace changes around lines I plan to modify, which isn't ideal.
Answered by @martinvonz @ #5710 (comment).
I hadn't realised that
jj absorb
looks for changes at line-level, rather than file-level.Keeping this open to see if there is appetite for a flag along the lines of
--granularity=file
, with--granularity=line
being the default behaviour. Or perhapsjj absorb
could simply fall back to absorbing into the same file if there are no line-level matches?I appreciate I can do this manually with
jj squash
, butjj absorb
is a lot more convenient!Original Post
Apologies if PEBCAK and not a bug, but I assumed this would work based on the description of
jj absorb
...I can't share the exact commits and repository as they're private, but I'll describe the state of things.
I'm working on a feature, based off my colleague's branch, as follows:
I've made some changes in
@
that modify files infoo/
(most recent change modifying these files was invzrmlxxs
). Now, both my colleague and myself have made changes in these files.If I run
jj absorb
with no arguments, the output is:This is what I would expect.
However, I don't want to modify my colleague's changes. Instead, I want to absorb into my own previous changes, so I run
jj absorb --into='mutable() & mine()'
, and the output is:Why is
jj
not absorbing the changes into my previous change (vzrmlxxs
) when I limit the revisions in this way, but is happy to modify my colleague's changes?The text was updated successfully, but these errors were encountered: