Project

General

Profile

Common git operations » History » Version 11

cryptogopher, 2020-07-10 02:31

1 1 cryptogopher
h1. Common git operations
2
3 5 cryptogopher
{{>toc}}
4 1 cryptogopher
5
Prerequisites:
6
<pre>
7
cd ~/plugins/issue_recurring
8
</pre>
9
10
h2. Issue resolution in separate branch
11
12 2 cryptogopher
h3. Create separate branch for issue
13 3 cryptogopher
14 2 cryptogopher
# Checkout and update master:
15
<pre>
16
$ git checkout master
17
$ git pull
18
</pre>
19
# Create, checkout new branch and push it to remote (so it will be tracked and replicated on it.michalczyk.pro):
20
<pre>
21
$ git checkout -b issueN
22
$ git push -u origin issueN
23
</pre>
24 9 cryptogopher
# Reload all files open in vim:
25 7 cryptogopher
<pre>
26
:bufdo! e
27
</pre>
28
29 2 cryptogopher
h3. Merge issue branch into master
30
31
# Push uncommited changes on issue branch.
32 1 cryptogopher
# Checkout and update master:
33
<pre>
34
$ git checkout master
35
$ git pull
36
</pre>
37 6 cryptogopher
# Merge adding comment _closes #N_ and push issueN branch:
38 1 cryptogopher
<pre>
39
$ git merge issueN
40
$ git push
41
</pre>
42
# Delete merged branch from local and remote:
43
<pre>
44
$ git branch -d issueN
45
$ git push origin :issueN
46
</pre>
47
# Verify:
48
<pre>
49
$ git branch -a
50
</pre>
51 5 cryptogopher
52 10 cryptogopher
h2. Pull requests
53
54
h3. Checkout pull request locally (for editing, testing etc.)
55
56 11 cryptogopher
# Fetch pull request based on its number into new branch and switch to new branch:
57
<pre>
58
git fetch origin pull/N/head:prN
59
git checkout prN
60
</pre>
61
62 5 cryptogopher
h2. Release
63 4 cryptogopher
64
h3. Move tag to different commit (e.g. after fixing some mistake)
65
66
# Remove tag from remote (if it has been pushed):
67
<pre>
68
git push origin :refs/tags/1.3
69
</pre>
70
# Force replacement of existing tag with one referencing most recent commit:
71
<pre>
72
git tag -fa 1.3
73
</pre>
74
# Push:
75
<pre>
76
git push origin 1.3
77
</pre>