Debian Codegraph @

demos/resolve_conflicts.svg

raw
1 <!-- Created with term-transcript v0.4.0 (https://github.com/slowli/term-transcript) -->
2 <svg viewBox="0 0 720 1712" width="720" height="1712" xmlns="http://www.w3.org/2000/svg">
3 <style>
4 .container {
5 font: 14px Fira Code, Liberation Mono, SFMono-Regular, Consolas, Menlo, monospace;
6 line-height: 18px;
7 }
8 .input,.output,.output-bg {
9 white-space: pre;
10 }
11 .input-bg { fill: #fff; fill-opacity: 0.1; }
12 .output-bg { user-select: none; text-rendering: geometricPrecision; stroke-width: 0.1; }
13 .bold,.prompt { font-weight: 600; }
14 .italic { font-style: italic; }
15 .underline { text-decoration: underline; }
16 .dimmed { fill-opacity: 0.7; }
17 .hard-br { font-size: 16px; fill-opacity: 0.8; user-select: none; }
18 .fg0 { fill: #0c0c0c; } .output-bg .fg0 { stroke: #0c0c0c; }
19 .fg1 { fill: #c50f1f; } .output-bg .fg1 { stroke: #c50f1f; }
20 .fg2 { fill: #13a10e; } .output-bg .fg2 { stroke: #13a10e; }
21 .fg3 { fill: #c19c00; } .output-bg .fg3 { stroke: #c19c00; }
22 .fg4 { fill: #0037da; } .output-bg .fg4 { stroke: #0037da; }
23 .fg5 { fill: #881798; } .output-bg .fg5 { stroke: #881798; }
24 .fg6 { fill: #3a96dd; } .output-bg .fg6 { stroke: #3a96dd; }
25 .fg7 { fill: #cccccc; } .output-bg .fg7 { stroke: #cccccc; }
26 .fg8 { fill: #767676; } .output-bg .fg8 { stroke: #767676; }
27 .fg9 { fill: #e74856; } .output-bg .fg9 { stroke: #e74856; }
28 .fg10 { fill: #16c60c; } .output-bg .fg10 { stroke: #16c60c; }
29 .fg11 { fill: #f9f1a5; } .output-bg .fg11 { stroke: #f9f1a5; }
30 .fg12 { fill: #3b78ff; } .output-bg .fg12 { stroke: #3b78ff; }
31 .fg13 { fill: #b4009e; } .output-bg .fg13 { stroke: #b4009e; }
32 .fg14 { fill: #61d6d6; } .output-bg .fg14 { stroke: #61d6d6; }
33 .fg15 { fill: #f2f2f2; } .output-bg .fg15 { stroke: #f2f2f2; }
34 </style>
35 <rect width="100%" height="100%" y="0" rx="4.5" style="fill: #0c0c0c;" />
36 <svg x="0" y="10" width="720" height="1692" viewBox="0 0 720 1692">
37 <g class="input-bg"></g>
38 <text class="container fg7"><tspan xml:space="preserve" x="10" y="14" class="output">
39 </tspan><tspan xml:space="preserve" x="10" y="32" class="output"><tspan class="fg2"># We are on the master branch of the octocat/Hello-World repo,</tspan>
40 </tspan><tspan xml:space="preserve" x="10" y="50" class="output"><tspan class="fg2"># represented by the "master" bookmark on the parent commit.</tspan>
41 </tspan><tspan xml:space="preserve" x="10" y="68" class="output">
42 </tspan><tspan xml:space="preserve" x="10" y="86" class="output">$ jj log
43 </tspan><tspan xml:space="preserve" x="10" y="104" class="output"><tspan class="bold fg2">@</tspan>  <tspan class="bold fg13">u</tspan><tspan class="bold fg8">yukmqyv</tspan><tspan class="bold"> </tspan><tspan class="bold fg3">[email protected]</tspan><tspan class="bold"> </tspan><tspan class="bold fg14">2025-12-23 20:48:00</tspan><tspan class="bold"> </tspan><tspan class="bold fg12">c</tspan><tspan class="bold fg8">55f7376</tspan>
44 </tspan><tspan xml:space="preserve" x="10" y="122" class="output">│  <tspan class="bold fg10">(empty)</tspan><tspan class="bold"> </tspan><tspan class="bold fg10">(no description set)</tspan>
45 </tspan><tspan xml:space="preserve" x="10" y="140" class="output"><tspan class="bold fg14">◆</tspan>  <tspan class="bold fg5">o</tspan><tspan class="fg8">rrkosyo</tspan> <tspan class="fg3">[email protected]</tspan> <tspan class="fg6">2012-03-06 17:06:50</tspan> <tspan class="fg5">master</tspan> <tspan class="bold fg4">7</tspan><tspan class="fg8">fd1a60b</tspan>
46 </tspan><tspan xml:space="preserve" x="10" y="158" class="output">│  <tspan class="fg2">(empty)</tspan> Merge pull request #6 from Spaceghost/patch-1
47 </tspan><tspan xml:space="preserve" x="10" y="176" class="output">~
48 </tspan><tspan xml:space="preserve" x="10" y="194" class="output">
49 </tspan><tspan xml:space="preserve" x="10" y="212" class="output"><tspan class="fg2"># Let's make an edit that will conflict</tspan>
50 </tspan><tspan xml:space="preserve" x="10" y="230" class="output"><tspan class="fg2"># when we rebase it:</tspan>
51 </tspan><tspan xml:space="preserve" x="10" y="248" class="output">
52 </tspan><tspan xml:space="preserve" x="10" y="266" class="output">$ jj describe -m "README: say which world"
53 </tspan><tspan xml:space="preserve" x="10" y="284" class="output">Working copy  (@) now at: <tspan class="bold fg13">u</tspan><tspan class="bold fg8">yukmqyv</tspan><tspan class="bold"> </tspan><tspan class="bold fg12">2</tspan><tspan class="bold fg8">817dd10</tspan><tspan class="bold"> </tspan><tspan class="bold fg10">(empty)</tspan><tspan class="bold"> README: say which world</tspan>
54 </tspan><tspan xml:space="preserve" x="10" y="302" class="output">Parent commit (@-)      : <tspan class="bold fg5">o</tspan><tspan class="fg8">rrkosyo</tspan> <tspan class="bold fg4">7</tspan><tspan class="fg8">fd1a60b</tspan> <tspan class="fg5">master</tspan><tspan class="fg8"> | </tspan><tspan class="fg2">(empty)</tspan> Merge pull request <tspan class="hard-br" rotate="45" dx=".1em" dy="-.2em">↓</tspan>
55 </tspan><tspan xml:space="preserve" x="10" y="320" class="output">#6 from Spaceghost/patch-1
56 </tspan><tspan xml:space="preserve" x="10" y="338" class="output">$ echo "Hello Earth!" &gt; README
57 </tspan><tspan xml:space="preserve" x="10" y="356" class="output">$ jj diff
58 </tspan><tspan xml:space="preserve" x="10" y="374" class="output"><tspan class="fg3">Modified regular file README:</tspan>
59 </tspan><tspan xml:space="preserve" x="10" y="392" class="output"><tspan class="fg1">   1</tspan> <tspan class="fg2">   1</tspan>: Hello <tspan class="underline fg1">World</tspan><tspan class="underline fg2">Earth</tspan>!
60 </tspan><tspan xml:space="preserve" x="10" y="410" class="output">
61 </tspan><tspan xml:space="preserve" x="10" y="428" class="output"><tspan class="fg2"># We're going to rebase it onto commit b1.</tspan>
62 </tspan><tspan xml:space="preserve" x="10" y="446" class="output"><tspan class="fg2"># That commit looks like this:</tspan>
63 </tspan><tspan xml:space="preserve" x="10" y="464" class="output">
64 </tspan><tspan xml:space="preserve" x="10" y="482" class="output">$ jj diff -r b1
65 </tspan><tspan xml:space="preserve" x="10" y="500" class="output"><tspan class="fg3">Modified regular file README:</tspan>
66 </tspan><tspan xml:space="preserve" x="10" y="518" class="output"><tspan class="fg1">   1</tspan> <tspan class="fg2">   1</tspan>: Hello <tspan class="underline fg1">World</tspan><tspan class="underline fg2">world</tspan>!
67 </tspan><tspan xml:space="preserve" x="10" y="536" class="output">
68 </tspan><tspan xml:space="preserve" x="10" y="554" class="output"><tspan class="fg2"># Now rebase:</tspan>
69 </tspan><tspan xml:space="preserve" x="10" y="572" class="output">
70 </tspan><tspan xml:space="preserve" x="10" y="590" class="output">$ jj rebase --onto b1
71 </tspan><tspan xml:space="preserve" x="10" y="608" class="output">Rebased 1 commits to destination
72 </tspan><tspan xml:space="preserve" x="10" y="626" class="output">Working copy  (@) now at: <tspan class="bold fg13">u</tspan><tspan class="bold fg8">yukmqyv</tspan><tspan class="bold"> </tspan><tspan class="bold fg12">3</tspan><tspan class="bold fg8">839cde4</tspan><tspan class="bold"> </tspan><tspan class="bold fg9">(conflict)</tspan><tspan class="bold"> README: say which world</tspan>
73 </tspan><tspan xml:space="preserve" x="10" y="644" class="output">Parent commit (@-)      : <tspan class="bold fg5">t</tspan><tspan class="fg8">pstlust</tspan> <tspan class="bold fg4">b</tspan><tspan class="fg8">1b3f972</tspan> <tspan class="fg5">octocat-patch-1@origin</tspan><tspan class="fg8"> | </tspan>sentence ca<tspan class="hard-br" rotate="45" dx=".1em" dy="-.2em">↓</tspan>
74 </tspan><tspan xml:space="preserve" x="10" y="662" class="output">se
75 </tspan><tspan xml:space="preserve" x="10" y="680" class="output">Added 0 files, modified 1 files, removed 0 files
76 </tspan><tspan xml:space="preserve" x="10" y="698" class="output"><tspan class="bold fg3">Warning: </tspan><tspan class="bold">There are unresolved conflicts at these paths:</tspan>
77 </tspan><tspan xml:space="preserve" x="10" y="716" class="output">README    <tspan class="fg3">2-sided conflict</tspan>
78 </tspan><tspan xml:space="preserve" x="10" y="734" class="output">New conflicts appeared in 1 commits:
79 </tspan><tspan xml:space="preserve" x="10" y="752" class="output">  <tspan class="bold fg13">u</tspan><tspan class="bold fg8">yukmqyv</tspan><tspan class="bold"> </tspan><tspan class="bold fg12">3</tspan><tspan class="bold fg8">839cde4</tspan><tspan class="bold"> </tspan><tspan class="bold fg9">(conflict)</tspan><tspan class="bold"> README: say which world</tspan>
80 </tspan><tspan xml:space="preserve" x="10" y="770" class="output"><tspan class="bold fg6">Hint: </tspan>To resolve the conflicts, start by creating a commit on top of
81 </tspan><tspan xml:space="preserve" x="10" y="788" class="output">the conflicted commit:
82 </tspan><tspan xml:space="preserve" x="10" y="806" class="output">  jj new <tspan class="bold fg5">u</tspan><tspan class="fg8">yukmqyv</tspan>
83 </tspan><tspan xml:space="preserve" x="10" y="824" class="output">Then use `jj resolve`, or edit the conflict markers in the file directly.
84 </tspan><tspan xml:space="preserve" x="10" y="842" class="output">Once the conflicts are resolved, you can inspect the result with `jj diff`.
85 </tspan><tspan xml:space="preserve" x="10" y="860" class="output">Then run `jj squash` to move the resolution into the conflicted commit.
86 </tspan><tspan xml:space="preserve" x="10" y="878" class="output">
87 </tspan><tspan xml:space="preserve" x="10" y="896" class="output"><tspan class="fg2"># That seemed to succeed but we are also told there is now a conflict.</tspan>
88 </tspan><tspan xml:space="preserve" x="10" y="914" class="output"><tspan class="fg2"># Let's take a look at the repo:</tspan>
89 </tspan><tspan xml:space="preserve" x="10" y="932" class="output">
90 </tspan><tspan xml:space="preserve" x="10" y="950" class="output">$ jj log
91 </tspan><tspan xml:space="preserve" x="10" y="968" class="output"><tspan class="bold fg1">@</tspan>  <tspan class="bold fg13">u</tspan><tspan class="bold fg8">yukmqyv</tspan><tspan class="bold"> </tspan><tspan class="bold fg3">[email protected]</tspan><tspan class="bold"> </tspan><tspan class="bold fg14">2025-12-23 20:48:01</tspan><tspan class="bold"> </tspan><tspan class="bold fg12">3</tspan><tspan class="bold fg8">839cde4</tspan><tspan class="bold"> </tspan><tspan class="bold fg9">(conflict)</tspan>
92 </tspan><tspan xml:space="preserve" x="10" y="986" class="output">│  <tspan class="bold">README: say which world</tspan>
93 </tspan><tspan xml:space="preserve" x="10" y="1004" class="output"><tspan class="bold fg14">◆</tspan>  <tspan class="bold fg5">t</tspan><tspan class="fg8">pstlust</tspan> <tspan class="fg3">[email protected]</tspan> <tspan class="fg6">2018-05-10 11:55:19</tspan>
94 </tspan><tspan xml:space="preserve" x="10" y="1022" class="output">│  <tspan class="fg5">octocat-patch-1@origin</tspan> <tspan class="bold fg4">b</tspan><tspan class="fg8">1b3f972</tspan>
95 </tspan><tspan xml:space="preserve" x="10" y="1040" class="output">│  sentence case
96 </tspan><tspan xml:space="preserve" x="10" y="1058" class="output"><tspan class="bold fg14">◆</tspan>  <tspan class="bold fg5">o</tspan><tspan class="fg8">rrkosyo</tspan> <tspan class="fg3">[email protected]</tspan> <tspan class="fg6">2012-03-06 17:06:50</tspan> <tspan class="fg5">master</tspan> <tspan class="bold fg4">7</tspan><tspan class="fg8">fd1a60b</tspan>
97 </tspan><tspan xml:space="preserve" x="10" y="1076" class="output">│  <tspan class="fg2">(empty)</tspan> Merge pull request #6 from Spaceghost/patch-1
98 </tspan><tspan xml:space="preserve" x="10" y="1094" class="output">~
99 </tspan><tspan xml:space="preserve" x="10" y="1112" class="output">$ jj status
100 </tspan><tspan xml:space="preserve" x="10" y="1130" class="output">Working copy changes:
101 </tspan><tspan xml:space="preserve" x="10" y="1148" class="output"><tspan class="fg6">M README</tspan>
102 </tspan><tspan xml:space="preserve" x="10" y="1166" class="output">Working copy  (@) : <tspan class="bold fg13">u</tspan><tspan class="bold fg8">yukmqyv</tspan><tspan class="bold"> </tspan><tspan class="bold fg12">3</tspan><tspan class="bold fg8">839cde4</tspan><tspan class="bold"> </tspan><tspan class="bold fg9">(conflict)</tspan><tspan class="bold"> README: say which world</tspan>
103 </tspan><tspan xml:space="preserve" x="10" y="1184" class="output">Parent commit (@-): <tspan class="bold fg5">t</tspan><tspan class="fg8">pstlust</tspan> <tspan class="bold fg4">b</tspan><tspan class="fg8">1b3f972</tspan> <tspan class="fg5">octocat-patch-1@origin</tspan><tspan class="fg8"> | </tspan>sentence case
104 </tspan><tspan xml:space="preserve" x="10" y="1202" class="output"><tspan class="bold fg3">Warning: </tspan><tspan class="bold">There are unresolved conflicts at these paths:</tspan>
105 </tspan><tspan xml:space="preserve" x="10" y="1220" class="output">README    <tspan class="fg3">2-sided conflict</tspan>
106 </tspan><tspan xml:space="preserve" x="10" y="1238" class="output">
107 </tspan><tspan xml:space="preserve" x="10" y="1256" class="output"><tspan class="fg2"># Indeed, the rebased commit has a conflict. The conflicted file</tspan>
108 </tspan><tspan xml:space="preserve" x="10" y="1274" class="output"><tspan class="fg2"># in the working copy looks like this:</tspan>
109 </tspan><tspan xml:space="preserve" x="10" y="1292" class="output">
110 </tspan><tspan xml:space="preserve" x="10" y="1310" class="output">$ cat README
111 </tspan><tspan xml:space="preserve" x="10" y="1328" class="output">&lt;&lt;&lt;&lt;&lt;&lt;&lt; conflict 1 of 1
112 </tspan><tspan xml:space="preserve" x="10" y="1346" class="output">%%%%%%% diff from: orrkosyo 7fd1a60b "Merge pull request #6 from Spaceghost/patc<tspan class="hard-br" rotate="45" dx=".1em" dy="-.2em">↓</tspan>
113 </tspan><tspan xml:space="preserve" x="10" y="1364" class="output">h-1" (parents of rebased revision)
114 </tspan><tspan xml:space="preserve" x="10" y="1382" class="output">\\\\\\\        to: tpstlust b1b3f972 "sentence case" (rebase destination)
115 </tspan><tspan xml:space="preserve" x="10" y="1400" class="output">-Hello World!
116 </tspan><tspan xml:space="preserve" x="10" y="1418" class="output">+Hello world!
117 </tspan><tspan xml:space="preserve" x="10" y="1436" class="output">+++++++ uyukmqyv b597b050 "README: say which world" (rebased revision)
118 </tspan><tspan xml:space="preserve" x="10" y="1454" class="output">Hello Earth!
119 </tspan><tspan xml:space="preserve" x="10" y="1472" class="output">&gt;&gt;&gt;&gt;&gt;&gt;&gt; conflict 1 of 1 ends
120 </tspan><tspan xml:space="preserve" x="10" y="1490" class="output">
121 </tspan><tspan xml:space="preserve" x="10" y="1508" class="output"><tspan class="fg2"># Now we will resolve the conflict:</tspan>
122 </tspan><tspan xml:space="preserve" x="10" y="1526" class="output">
123 </tspan><tspan xml:space="preserve" x="10" y="1544" class="output">$ echo "Hello earth!" &gt; README
124 </tspan><tspan xml:space="preserve" x="10" y="1562" class="output">
125 </tspan><tspan xml:space="preserve" x="10" y="1580" class="output"><tspan class="fg2"># The status command no longer reports it:</tspan>
126 </tspan><tspan xml:space="preserve" x="10" y="1598" class="output">
127 </tspan><tspan xml:space="preserve" x="10" y="1616" class="output">$ jj status
128 </tspan><tspan xml:space="preserve" x="10" y="1634" class="output">Working copy changes:
129 </tspan><tspan xml:space="preserve" x="10" y="1652" class="output"><tspan class="fg6">M README</tspan>
130 </tspan><tspan xml:space="preserve" x="10" y="1670" class="output">Working copy  (@) : <tspan class="bold fg13">u</tspan><tspan class="bold fg8">yukmqyv</tspan><tspan class="bold"> </tspan><tspan class="bold fg12">1</tspan><tspan class="bold fg8">7813c30</tspan><tspan class="bold"> README: say which world</tspan>
131 </tspan><tspan xml:space="preserve" x="10" y="1688" class="output">Parent commit (@-): <tspan class="bold fg5">t</tspan><tspan class="fg8">pstlust</tspan> <tspan class="bold fg4">b</tspan><tspan class="fg8">1b3f972</tspan> <tspan class="fg5">octocat-patch-1@origin</tspan><tspan class="fg8"> | </tspan>sentence case
132 </tspan></text>
133 </svg>
134 </svg>