-
Notifications
You must be signed in to change notification settings - Fork 0
/
mergetool
100 lines (98 loc) · 3.04 KB
/
mergetool
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
anders@balanced-tree:/tmp/foo$ seq 5 > numbers
anders@balanced-tree:/tmp/foo$ git init
Initialized empty Git repository in /tmp/foo/.git/
anders@balanced-tree:/tmp/foo$ git add numbers
anders@balanced-tree:/tmp/foo$ git commit -m '1, 2, 3, 4, 5!'
Created initial commit 4172330: 1, 2, 3, 4, 5!
1 files changed, 5 insertions(+), 0 deletions(-)
create mode 100644 numbers
anders@balanced-tree:/tmp/foo$ git checkout -b andersk
Switched to a new branch "andersk"
anders@balanced-tree:/tmp/foo$ git branch
* {\color{green}andersk}
master
anders@balanced-tree:/tmp/foo$ (echo 0; cat numbers) | sponge numbers
anders@balanced-tree:/tmp/foo$ git diff
\textbf{diff --git a/numbers b/numbers
index 8a1218a..e8371f0 100644
--- a/numbers
+++ b/numbers}
{\color{cyan}@@ -1,3 +1,4 @@}
{\color{green}+0}
1
2
3
anders@balanced-tree:/tmp/foo$ git add numbers
anders@balanced-tree:/tmp/foo$ git commit -m 'Numbers start at 0.'
Created commit 7aeb494: Numbers start at 0.
1 files changed, 1 insertions(+), 0 deletions(-)
anders@balanced-tree:/tmp/foo$ git checkout master
Switched to branch "master"
anders@balanced-tree:/tmp/foo$ echo 6 >> numbers
anders@balanced-tree:/tmp/foo$ git add numbers
anders@balanced-tree:/tmp/foo$ git commit -m '6 is a number too.'
Created commit 383c158: 6 is a number too.
1 files changed, 1 insertions(+), 0 deletions(-)
anders@balanced-tree:/tmp/foo$ git merge andersk
Auto-merged numbers
Merge made by recursive.
numbers | 1 {\color{green}+}
1 files changed, 1 insertions(+), 0 deletions(-)
anders@balanced-tree:/tmp/foo$ cat numbers
0
1
2
3
4
5
6
anders@balanced-tree:/tmp/foo$ git checkout andersk
Switched to branch "andersk"
anders@balanced-tree:/tmp/foo$ echo 5½ >> numbers
anders@balanced-tree:/tmp/foo$ git add numbers
anders@balanced-tree:/tmp/foo$ git commit -m '5½ is a better number.'
Created commit 5360c2d: 5½ is a better number.
1 files changed, 1 insertions(+), 0 deletions(-)
anders@balanced-tree:/tmp/foo$ git checkout master
Switched to branch "master"
anders@balanced-tree:/tmp/foo$ git merge andersk
Auto-merged numbers
CONFLICT (content): Merge conflict in numbers
Automatic merge failed; fix conflicts and then commit the result.
anders@balanced-tree:/tmp/foo$ git status
numbers: needs merge
# On branch master
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
#
# {\color{red}unmerged: numbers}
#
no changes added to commit (use "git add" and/or "git commit -a")
anders@balanced-tree:/tmp/foo$ git mergetool
Merging the files: numbers
Normal merge conflict for 'numbers':
{local}: modified
{remote}: modified
Hit return to start merge resolution tool (meld):
anders@balanced-tree:/tmp/foo$ cat numbers
0
1
2
3
4
5
5½
6
anders@balanced-tree:/tmp/foo$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# {\color{green}modified: numbers}
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# {\color{red}numbers.orig}
anders@balanced-tree:/tmp/foo$ git commit
Created commit fc8da7a: Merge branch 'andersk'