Project

General

Profile

Actions

Common git operations

Prerequisites:

cd ~/plugins/issue_recurring

Issue/pull request resolution in separate branch

Create separate branch for issue

  1. Checkout and update master:
    $ git checkout master
    $ git pull
    
  2. Create, checkout new branch and push it to remote (so it will be tracked and replicated on it.michalczyk.pro):
    $ git checkout -b issueN
    $ git push -u origin issueN
    
  3. Reload all files open in vim:
    :bufdo! e
    

Checkout pull request locally (for editing, testing etc.)

Github docs

  1. Fetch pull request based on its number into new branch and switch to new branch:
    $ git fetch origin pull/N/head:prN
    $ git checkout prN
    
  2. (optionally) Push newly created branch:
    git push -u origin prN
    

Merge issue/pull request branch into master

  1. Push uncommited changes on issue branch.
  2. Checkout and update master:
    $ git checkout master
    $ git pull
    
  3. Merge adding comment closes #N (for issue branch), optionally view commits and push issueN/prN branch:
    $ git merge issueN
    $ git log origin/master..HEAD
    $ git push
    
  4. Delete merged branch from local and remote:
    $ git branch -d issueN
    $ git push origin :issueN
    
  5. Verify:
    $ git branch -a
    

Release

Move tag to different commit (e.g. after fixing some mistake)

  1. Remove tag from remote (if it has been pushed):
    git push origin :refs/tags/1.3
    
  2. Force replacement of existing tag with one referencing most recent commit:
    git tag -fa 1.3
    
  3. Push:
    git push origin 1.3
    

Other

Change remote URL from HTTPS to SSH (required by Github's no-password policy)

  1. Check current URL:
    git remote -v
    
  2. Change to SSH:
    git remote set-url origin git@github.com:cryptogopher/issue_recurring.git
    

Updated by cryptogopher about 2 years ago · 18 revisions

Also available in: PDF HTML TXT