Skip to content

Commit b84522d

Browse files
committed
Better example.
1 parent 9728101 commit b84522d

File tree

2 files changed

+70
-40
lines changed

2 files changed

+70
-40
lines changed

meld.png

3.26 KB
Loading

mergetool

+70-40
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,100 @@
1+
anders@balanced-tree:/tmp/foo$ seq 5 > numbers
12
anders@balanced-tree:/tmp/foo$ git init
23
Initialized empty Git repository in /tmp/foo/.git/
3-
anders@balanced-tree:/tmp/foo$ echo 'hello' > file
4-
anders@balanced-tree:/tmp/foo$ git add file
5-
anders@balanced-tree:/tmp/foo$ git commit -m 'Initial commit.'
6-
Created initial commit 99137ab: Initial commit.
7-
1 files changed, 1 insertions(+), 0 deletions(-)
8-
create mode 100644 file
9-
anders@balanced-tree:/tmp/foo$ git checkout -b branch
10-
Switched to a new branch "branch"
11-
anders@balanced-tree:/tmp/foo$ echo 'world' >> file
12-
anders@balanced-tree:/tmp/foo$ git add file
13-
anders@balanced-tree:/tmp/foo$ git commit -m 'Add "world".'
14-
Created commit 83649e8: Add "world".
4+
anders@balanced-tree:/tmp/foo$ git add numbers
5+
anders@balanced-tree:/tmp/foo$ git commit -m '1, 2, 3, 4, 5!'
6+
Created initial commit 4172330: 1, 2, 3, 4, 5!
7+
1 files changed, 5 insertions(+), 0 deletions(-)
8+
create mode 100644 numbers
9+
anders@balanced-tree:/tmp/foo$ git checkout -b andersk
10+
Switched to a new branch "andersk"
11+
anders@balanced-tree:/tmp/foo$ git branch
12+
* {\color{green}andersk}
13+
master
14+
anders@balanced-tree:/tmp/foo$ (echo 0; cat numbers) | sponge numbers
15+
anders@balanced-tree:/tmp/foo$ git diff
16+
\textbf{diff --git a/numbers b/numbers
17+
index 8a1218a..e8371f0 100644
18+
--- a/numbers
19+
+++ b/numbers}
20+
{\color{cyan}@@ -1,3 +1,4 @@}
21+
{\color{green}+0}
22+
1
23+
2
24+
3
25+
anders@balanced-tree:/tmp/foo$ git add numbers
26+
anders@balanced-tree:/tmp/foo$ git commit -m 'Numbers start at 0.'
27+
Created commit 7aeb494: Numbers start at 0.
1528
1 files changed, 1 insertions(+), 0 deletions(-)
1629
anders@balanced-tree:/tmp/foo$ git checkout master
1730
Switched to branch "master"
18-
anders@balanced-tree:/tmp/foo$ echo 'git' >> file
19-
anders@balanced-tree:/tmp/foo$ git add file
20-
anders@balanced-tree:/tmp/foo$ git commit -m 'Add "git".'
21-
Created commit 308abbb: Add "git".
31+
anders@balanced-tree:/tmp/foo$ echo 6 >> numbers
32+
anders@balanced-tree:/tmp/foo$ git add numbers
33+
anders@balanced-tree:/tmp/foo$ git commit -m '6 is a number too.'
34+
Created commit 383c158: 6 is a number too.
35+
1 files changed, 1 insertions(+), 0 deletions(-)
36+
anders@balanced-tree:/tmp/foo$ git merge andersk
37+
Auto-merged numbers
38+
Merge made by recursive.
39+
numbers | 1 {\color{green}+}
2240
1 files changed, 1 insertions(+), 0 deletions(-)
23-
anders@balanced-tree:/tmp/foo$ git merge branch
24-
Auto-merged file
25-
CONFLICT (content): Merge conflict in file
41+
anders@balanced-tree:/tmp/foo$ cat numbers
42+
0
43+
1
44+
2
45+
3
46+
4
47+
5
48+
6
49+
anders@balanced-tree:/tmp/foo$ git checkout andersk
50+
Switched to branch "andersk"
51+
anders@balanced-tree:/tmp/foo$ echo 5½ >> numbers
52+
anders@balanced-tree:/tmp/foo$ git add numbers
53+
anders@balanced-tree:/tmp/foo$ git commit -m '5½ is a better number.'
54+
Created commit 5360c2d: 5½ is a better number.
55+
1 files changed, 1 insertions(+), 0 deletions(-)
56+
anders@balanced-tree:/tmp/foo$ git checkout master
57+
Switched to branch "master"
58+
anders@balanced-tree:/tmp/foo$ git merge andersk
59+
Auto-merged numbers
60+
CONFLICT (content): Merge conflict in numbers
2661
Automatic merge failed; fix conflicts and then commit the result.
2762
anders@balanced-tree:/tmp/foo$ git status
28-
file: needs merge
63+
numbers: needs merge
2964
# On branch master
3065
# Changed but not updated:
3166
# (use "git add <file>..." to update what will be committed)
3267
#
33-
# {\color{red}unmerged: file}
34-
#
35-
# Untracked files:
36-
# (use "git add <file>..." to include in what will be committed)
68+
# {\color{red}unmerged: numbers}
3769
#
38-
# {\color{red}file.orig}
3970
no changes added to commit (use "git add" and/or "git commit -a")
40-
anders@balanced-tree:/tmp/foo$ cat file
41-
hello
42-
<<<<<<< HEAD:file
43-
git
44-
=======
45-
world
46-
>>>>>>> branch:file
4771
anders@balanced-tree:/tmp/foo$ git mergetool
48-
Merging the files: file
72+
Merging the files: numbers
4973

50-
Normal merge conflict for 'file':
74+
Normal merge conflict for 'numbers':
5175
{local}: modified
5276
{remote}: modified
5377
Hit return to start merge resolution tool (meld):
54-
anders@balanced-tree:/tmp/foo$ cat file
55-
hello
56-
git world
78+
anders@balanced-tree:/tmp/foo$ cat numbers
79+
0
80+
1
81+
2
82+
3
83+
4
84+
5
85+
86+
6
5787
anders@balanced-tree:/tmp/foo$ git status
5888
# On branch master
5989
# Changes to be committed:
6090
# (use "git reset HEAD <file>..." to unstage)
6191
#
62-
# {\color{green}modified: file}
92+
# {\color{green}modified: numbers}
6393
#
6494
# Untracked files:
6595
# (use "git add <file>..." to include in what will be committed)
6696
#
67-
# {\color{red}file.orig}
97+
# {\color{red}numbers.orig}
6898
anders@balanced-tree:/tmp/foo$ git commit
69-
Created commit 498d489: Merge branch 'branch'
99+
Created commit fc8da7a: Merge branch 'andersk'
70100

0 commit comments

Comments
 (0)