Project

General

Profile

Common git operations » History » Version 8

cryptogopher, 2020-07-09 18:49

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