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