Skip to content

Commit a3f7e7a

Browse files
committed
update git post
1 parent ab64338 commit a3f7e7a

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

blog/03_git_commands_that_i_cant_remember.html

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,39 @@ <h1>GIT commands that I can't remember</h1>
1616
</p>
1717

1818
<p>
19-
2. Add remote
19+
2. Add remote:
2020
<br/>
2121
<br/>
2222
<i style="margin-left: 20px">> git remote add origin ssh://...</i>
2323
</p>
2424

2525
<p>
26-
3. Revert file to a version from commit
26+
3. Revert file to a version from commit:
2727
<br/>
2828
<br/>
2929
<i style="margin-left: 20px">> git checkout abcd-hash -- file/to/restore </i>
3030
</p>
3131

32+
<p>
33+
4. Make a patch:
34+
<br/>
35+
<br/>
36+
<i style="margin-left: 20px">> git format-patch -1 HASH </i>
37+
<div style="margin-left: 20px">
38+
The -1 flag tells Git how many commits should be included in the patch.
39+
<br/>
40+
<br/>
41+
Apply:
42+
<br/>
43+
<br/>
44+
<i>> git am < file.patch </i>
45+
</div>
46+
</p>
47+
48+
<p>
49+
Credits: <a href="https://stackoverflow.com/a/6658352/1361132">https://stackoverflow.com/a/6658352/1361132</a>
50+
</p>
51+
3252
<h5 style="color:grey;">
3353
1 November 2021
3454
</h5>

0 commit comments

Comments
 (0)