Git Aliases
clone1
- Git clone a repository but only one branch and one commit
Useful if you want the current state, the working copy, but do not need history.
Set the alias with git config --global alias.clone1 "clone --depth=1 --single-branch"
Usage: git clone1 example.org
Full command: git clone --depth=1 --single-branch
Usage with branch that is no master
; in this case dev
: git clone1 -b dev example.org
pr
- Fetch/Pull GitHub pull requests
This pr
alias allows you to fetch a pull requests code, labeled pr-<id>
, and check it out.
Set alias with: pr = !sh -c 'git fetch origin pull/$1/head:pr-$1 && git checkout pr-$1'
Usage: git pr 123
mr
- Fetch/Pull GitLab merge requests
This mr
alias allows you to fetch a merge requests code, labeled mr-<id>
, and check it out.
Alias: mr = !sh -c 'git fetch origin merge-requests/$1/head:mr-$1 && git checkout mr-$1' -
Usage: git mr 123