Project

General

Profile

Common git operations » History » Version 4

cryptogopher, 2019-07-14 17:52

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