Project

General

Profile

Common git operations » History » Version 9

cryptogopher, 2020-07-09 18:50

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 9 cryptogopher
# Reload all files open in vim:
25 7 cryptogopher
<pre>
26 7 cryptogopher
:bufdo! e
27 7 cryptogopher
</pre>
28 7 cryptogopher
29 2 cryptogopher
h3. Merge issue branch into master
30 2 cryptogopher
31 2 cryptogopher
# Push uncommited changes on issue branch.
32 1 cryptogopher
# Checkout and update master:
33 1 cryptogopher
<pre>
34 1 cryptogopher
$ git checkout master
35 1 cryptogopher
$ git pull
36 1 cryptogopher
</pre>
37 6 cryptogopher
# Merge adding comment _closes #N_ and push issueN branch:
38 1 cryptogopher
<pre>
39 1 cryptogopher
$ git merge issueN
40 1 cryptogopher
$ git push
41 1 cryptogopher
</pre>
42 1 cryptogopher
# Delete merged branch from local and remote:
43 1 cryptogopher
<pre>
44 1 cryptogopher
$ git branch -d issueN
45 1 cryptogopher
$ git push origin :issueN
46 1 cryptogopher
</pre>
47 1 cryptogopher
# Verify:
48 1 cryptogopher
<pre>
49 1 cryptogopher
$ git branch -a
50 1 cryptogopher
</pre>
51 5 cryptogopher
52 5 cryptogopher
h2. Release
53 4 cryptogopher
54 4 cryptogopher
h3. Move tag to different commit (e.g. after fixing some mistake)
55 4 cryptogopher
56 4 cryptogopher
# Remove tag from remote (if it has been pushed):
57 4 cryptogopher
<pre>
58 4 cryptogopher
git push origin :refs/tags/1.3
59 4 cryptogopher
</pre>
60 4 cryptogopher
# Force replacement of existing tag with one referencing most recent commit:
61 4 cryptogopher
<pre>
62 4 cryptogopher
git tag -fa 1.3
63 4 cryptogopher
</pre>
64 4 cryptogopher
# Push:
65 4 cryptogopher
<pre>
66 4 cryptogopher
git push origin 1.3
67 4 cryptogopher
</pre>