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