1GIT-CONFLICT(1) git-octopus suit Manual GIT-CONFLICT(1)
2
3
4
6 git-conflict - record conflict resolution.
7
9 git conflict <commit>
10 git conflict --continue | --abort | -l
11
13 git conflict records a conflict resolution between two branches that
14 git octopus will be able to reuse.
15
16 Start the recording process between the current branch and an other
17 branch with
18
19 $ git conflict an_other_branch
20
21 This will set the index and the working tree in the conflict state.
22 Once you’ve resolved it using git add, run git conflict --continue to
23 record the resolution. It will print a ref that points to the
24 resolution and resets the repository back to HEAD.
25
26 $ git conflict --continue
27 Conflict resolution created: refs/conflicts/75dd2c142264373c96a3341b2f9fb57bec7a7b7d
28
29 So git conflict doesn’t write history in your current branch.
30
31 git conflict --continue fails if a resolution for the same conflict
32 already exists. To override a resolution you will need to delete the
33 ref with git update-ref -d <ref> before recording the new one and
34 possibly force the push.
35
36 If you’re satisfied with the resolution you can push it using a simple
37 git push.
38
39 $ git push origin refs/conflicts/75dd2c142264373c96a3341b2f9fb57bec7a7b7d
40
42 -l
43 List all resolutions
44
45 --abort
46 Abort the current conflict resolution process, and try to
47 reconstruct the pre-merge state.
48
49 If there were uncommitted worktree changes present when the merge
50 started, git conflict --abort will in some cases be unable to
51 reconstruct these changes. It is therefore recommended to always
52 commit or stash your changes before running git conflict.
53
54 --continue
55 Record the index state as the resolution of the conflict and prints
56 its ref. The index and the working tree are reset back to HEAD.
57
59 The first thing to know is that a conflict ref, for instance
60 refs/conflicts/75dd2c142264373c96a3341b2f9fb57bec7a7b7d, is a standard
61 commit. You can inspect it with git show or any logger tool. It has an
62 author and dates etc...
63
64 The sha1 in the ref is a hash of the content of the conflict that has
65 been resolved. This allows resolutions to be found easily by other
66 commands given a conflict state by simply hashing the conflict content
67 and looking for a refs/conflict/<sha1> of the same name. A resolution
68 is not related to a particular branch, it can be applied in any
69 circumstances that produced the same conflict. This means that you can
70 continue to commit on your branches, you can rebase them, rename them
71 anyhow. As long as the same conflict is produced, the resolution can be
72 retrieved.
73
75 Currently, when reapplying a resolution, it will only look at both
76 modified files. So conflicts with renames, mod changes and deletions
77 are not handled. In addition, If you changed something in a file that
78 wasn’t in conflict state, it won’t be reapply neither.
79
80 Managing conflicts with more than a single branch is subtle. Let’s say
81 I’m on a local branch topic_mine and I have two different conflicts
82 with topic_arya and topic_eddard
83
84 A---B---C topic_mine
85 /
86 D---E---F---G topic_eddard
87 \
88 H---I topic_arya
89
90 I can write two resolutions
91
92 $ git conflict topic_arya
93 ...
94 $ git conflict --continue
95 Conflict resolution created: refs/conflicts/9a4b40f6ec56260618b820e19c8bd734fbfb744d
96 $ git conflict topic_eddard
97 ...
98 git conflict --continue
99 Conflict resolution created: refs/conflicts/8b3d16d22d0138ddbe6a1cd1a4cb9abf516a4609
100
101 If I run git octopus topic_* on my current branch (topic_mine), it will
102 starts by merging topic_arya (branches are sorted alphabeticaly), will
103 find the first resolution and then apply changes from topic_eddard,
104 find the 2nd resolution and end up with a success. Let’s push !
105
106 $ git push origin refs/conflicts/9a4b40f6ec56260618b820e19c8bd734fbfb744d refs/conflicts/8b3d16d22d0138ddbe6a1cd1a4cb9abf516a4609
107
108 Then Arya fetches and runs git octopus topic_* from her branch
109 topic_arya. It will starts by merging topic_eddard, no conflict happens
110 (assuming), then merges topic_mine. The actual conflict of that merge
111 will combine both conflicts because the current state have changes from
112 both topic_arya and topic_eddard. This means that this conflict has a
113 new signature that doesn’t have any resolution and the octopus will
114 fail. In this case git octopus is not associative.
115
117 Part of the git-octopus suit.
118
119
120
121git-octopus 1.4 07/13/2018 GIT-CONFLICT(1)