Changes between Version 94 and Version 95 of HowToGit


Ignore:
Timestamp:
07/27/20 00:19:41 (4 years ago)
Author:
nila
Comment:

Add description of GitHub PR aliases

Legend:

Unmodified
Added
Removed
Modified
  • HowToGit

    v94 v95  
    238238}}}
    239239
     240As a variation of the above, git alias can be set in git configuration file to make this even easier. Add following lines to either $HOME/.gitconfig (all git repositories) or .git/config (in source repository):
     241
     242{{{
     243[alias]
     244        pr = "!f() { git fetch -fu ${2:-upstream} refs/pull/$1/head:pr/$1 && git checkout pr/$1; }; f"
     245        pr-clean = "!git checkout master ; git for-each-ref refs/heads/pr/* --format=\"%(refname)\" | while read ref ; do branch=${ref#refs/heads/} ; git branch -D $branch ; done"
     246}}}
     247
     248How to use the aliases:
     249{{{
     250# Fetch and checkout a PR:
     251git pr <id> # (e.g. git pr 832)
     252
     253git branch -a
     254  master
     255* pr/832
     256  pr/837
     257  releasebranch_7_6
     258  releasebranch_7_8
     259
     260# Delete all PRs:
     261git pr-clean
     262}}}
     263
     264Note: to be on the safe side, only use this for testing pull request!
     265
    240266== Fixing bugs in a release branch ==
    241267