|
| 1 | +anders@balanced-tree:/tmp/foo$ seq 5 > numbers |
1 | 2 | anders@balanced-tree:/tmp/foo$ git init
|
2 | 3 | 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. |
15 | 28 | 1 files changed, 1 insertions(+), 0 deletions(-)
|
16 | 29 | anders@balanced-tree:/tmp/foo$ git checkout master
|
17 | 30 | 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}+} |
22 | 40 | 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 |
26 | 61 | Automatic merge failed; fix conflicts and then commit the result.
|
27 | 62 | anders@balanced-tree:/tmp/foo$ git status
|
28 |
| -file: needs merge |
| 63 | +numbers: needs merge |
29 | 64 | # On branch master
|
30 | 65 | # Changed but not updated:
|
31 | 66 | # (use "git add <file>..." to update what will be committed)
|
32 | 67 | #
|
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} |
37 | 69 | #
|
38 |
| -# {\color{red}file.orig} |
39 | 70 | 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 |
47 | 71 | anders@balanced-tree:/tmp/foo$ git mergetool
|
48 |
| -Merging the files: file |
| 72 | +Merging the files: numbers |
49 | 73 |
|
50 |
| -Normal merge conflict for 'file': |
| 74 | +Normal merge conflict for 'numbers': |
51 | 75 | {local}: modified
|
52 | 76 | {remote}: modified
|
53 | 77 | 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 | +5½ |
| 86 | +6 |
57 | 87 | anders@balanced-tree:/tmp/foo$ git status
|
58 | 88 | # On branch master
|
59 | 89 | # Changes to be committed:
|
60 | 90 | # (use "git reset HEAD <file>..." to unstage)
|
61 | 91 | #
|
62 |
| -# {\color{green}modified: file} |
| 92 | +# {\color{green}modified: numbers} |
63 | 93 | #
|
64 | 94 | # Untracked files:
|
65 | 95 | # (use "git add <file>..." to include in what will be committed)
|
66 | 96 | #
|
67 |
| -# {\color{red}file.orig} |
| 97 | +# {\color{red}numbers.orig} |
68 | 98 | anders@balanced-tree:/tmp/foo$ git commit
|
69 |
| -Created commit 498d489: Merge branch 'branch' |
| 99 | +Created commit fc8da7a: Merge branch 'andersk' |
70 | 100 |
|
0 commit comments