Confusion Surrounding the JJ CLI - Seeking Clarification #2691
-
BackgroundThis issue arises from a discussion on Hacker News (link), where I was advised to post an example on the issue tracker. Issue DetailsSteps Taken
jwheeler@gregory Projects % jj git clone git@github.com:johnwheeler/jjtest1.git
jwheeler@gregory Projects % cd jjtest1
jwheeler@gregory jjtest1 % echo a > file1
jwheeler@gregory jjtest1 % jj commit -m "added file1 with line a"
jwheeler@gregory jjtest1 % jj log
jwheeler@gregory jjtest1 % echo b >> file1
jwheeler@gregory jjtest1 % jj commit -m "added line b to file1"
jwheeler@gregory jjtest1 % jj log
jwheeler@gregory jjtest1 % jj git push -c @-
jwheeler@gregory Projects % rm -rf jjtest1
jwheeler@gregory Projects % jj git clone git@github.com:johnwheeler/jjtest1.git
jwheeler@gregory Projects % cd jjtest1
jwheeler@gregory jjtest1 % jj log At this point, the log history still looks linear. I get the same output as above for jj log, which I’ll omit here.
jwheeler@gregory jjtest1 % echo a >> file2
jwheeler@gregory jjtest1 % jj commit -m "added file2 with line a"
jwheeler@gregory jjtest1 % jj git push -c @-
jwheeler@gregory Projects % rm -rf jjtest1
jwheeler@gregory Projects % jj git clone git@github.com:johnwheeler/jjtest1.git
jwheeler@gregory Projects % cd jjtest1
jwheeler@gregory jjtest1 % jj log
At this point I become confused. I expect the history to be linear, but I see what appears to be a branch.
jwheeler@gregory jjtest1 % jj git fetch
jwheeler@gregory jjtest1 % jj log
Again, confused here. I don’t understand the branch - pr - merge - history conceptual model. At the end of the day, I was hoping for a clean commit log without branches. And, I even like to push my working copy assuming that’s ok so I can pull it down from another machine, but when I do that the history confused me. I would expect to see that as an @ at the top of the log with linear commit history. Confusion
Request for ClarificationI understand this might be a user error, but I'm struggling to comprehend the discrepancy between my expectations and the actual JJ log outputs. Any insights or explanations would be greatly appreciated. Originally posted on Hacker News discussion here |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
I think it's GitHub that created the merge commit. The default way of "merging" a PR is to do a |
Beta Was this translation helpful? Give feedback.
I think @martinvonz described what happened at step 6 of the question. I'll try to explain what happened at step 5.
At step 5, the commit
vvlz
that looks like a branch is the so-called "working-copy commit", marked by a@
symbol.jj
created that commit, but note that it is marked as "empty", meaning it has no diffs from its parent commit. So, the "branch" is trivial at this point. If you edit the working copy, the working copy commit is the one that will be modified. At that point, you'd have a real branch, since you are adding changes on top of commitkrzmz
. If you wanted to get rid of the branch, you could amend the changes you made intokrzmz
, butjj
doesn't do it until you explicitly …