forked from Nitaym/ourstheirs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
164 lines (157 loc) · 6.83 KB
/
index.html
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>git - ours vs theirs</title>
<link href='http://fonts.googleapis.com/css?family=Cambria+Math' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/normalize/0/normalize.min.css" type="text/css">
<link rel="stylesheet" href="css/style.css" type="text/css">
<script async src="https://www.googletagmanager.com/gtag/js?id=G-MWCNL01YBK"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-MWCNL01YBK');
</script>
</head>
<body>
<div class="scrollblock block-title">
<h1>git - ours & theirs</h1>
<p>cleaner merges for everyone </p>
<p class="meta">
by Nitay Megides<br>
please report issues on <a href="https://github.com/Nitaym/ourstheirs/issues">github</a>
</p>
</div>
<a name="merge"></a>
<div class="scrollblock block-merge">
<h2>git merge</h2>
<p>
let's merge conflicting branch <code><span class="branch2">feature</span></code> into <code><span class="branch1">master</span></code><br/>
<div class="console-background">
<div class="console">
<p class="console-text-own">
$ git checkout <span class="branch1">master</span> <br>
$ git merge <span class="branch2">feature</span> <br>
</p>
<p class="console-text-git">
Auto-merging Document <br>
CONFLICT (content): Merge conflict in codefile.js <br>
Automatic merge failed; fix conflicts and then commit the result.
</p>
</div>
</div>
<p>either fix the conflict manually by editing codefile.js, or use </p>
<div class="sidebyside-container">
<div class="sidebyside-one merge-highlight">
<div class="console-background">
<div class="console">
<p class="console-text-own">
$ git checkout <span class="branch1">--ours</span> codefile.js
</p>
</div>
</div>
to select the changes done in <code><span class="branch1">master</span></code>
</div>
<div class="sidebyside-two merge-highlight">
<div class="console-background">
<div class="console">
<p class="console-text-own">
$ git checkout <span class="branch2">--theirs</span> codefile.js
</p>
</div>
</div>
to select the changes done in <code><span class="branch2">feature</span> </code>
</div>
</div>
<br>
<p> then, continue as you would normally merge</p>
<div class="console-background">
<div class="console">
<p class="console-text-own">
$ git add codefile.js <br>
$ git merge --continue <br>
</p>
<p class="console-text-git">
[master 5d01884] Merge branch 'feature' <br>
</p>
</div>
</div>
</p>
</div>
<a name="checkout-replace"></a>
<div class="scrollblock block-rebase">
<h2>git rebase</h2>
<p>
let's rebase conflicting branch <code><span class="branch2">feature</span></code> over <code><span class="branch1">master</span></code><br/>
<div class="console-background">
<div class="console">
<p class="console-text-own">
$ git checkout <span class="branch2">feature</span> <br>
$ git rebase <span class="branch1">master</span> <br>
</p>
<p class="console-text-git">
First, rewinding head to replay your work on top of it... <br>
Applying: a commit done in branch feature <br>
error: Failed to merge in the changes. <br>
...
</p>
</div>
</div>
<p>either fix the conflict manually by editing codefile.js, or use </p>
<div class="sidebyside-container">
<div class="sidebyside-one rebase-highlight">
<div class="console-background">
<div class="console">
<p class="console-text-own">
$ git checkout <span class="branch1">--ours</span> codefile.js
</p>
</div>
</div>
to select the changes done in <code><span class="branch1">master</span></code>
</div>
<div class="sidebyside-two rebase-highlight">
<div class="console-background">
<div class="console">
<p class="console-text-own">
$ git checkout <span class="branch2">--theirs</span> codefile.js
</p>
</div>
</div>
to select the changes done in <code><span class="branch2">feature</span> </code>
</div>
</div>
<br>
<p> then, continue as you would normally do</p>
<div class="console-background">
<div class="console">
<p class="console-text-own">
$ git add codefile.js <br>
$ git rebase --continue <br>
</p>
<p class="console-text-git">
Applying: a commit done in branch feature <br>
</p>
</div>
</div>
</p>
</div>
<!-- <a name="hints"></a>
<div class="scrollblock block-hints">
<h2>useful hints</h2>
<p>
built-in git GUI<br />
<code>gitk</code><br />
use colorful git output<br />
<code>git config color.ui true</code><br />
show log on just one line per commit<br />
<code>git config format.pretty oneline</code><br />
use interactive adding<br />
<code>git add -i</code>
</p>
</div>
--> <a name="resources"></a>
<a name="comments"></a>
</body>
</html>