Project

General

Profile

Common git operations » History » Version 4

cryptogopher, 2019-07-14 17:52

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