LoginSignup
5
2

More than 5 years have passed since last update.

はじめに

今すぐalias登録すべきワンライナー by ゆめみ① Advent Calendar 2018 の2日目です。

私はプロジェクト依存のものはなるべくMakefileから利用するようにしているので,.zshrc は Git 関連程度で薄く保たれています。
皆さんの素敵なワンライナーが見られるよう,貢献させていただきます。
大いに盛り上がって欲しいと思います。

本題

業務で叩くものの中で1番多いであろうGitコマンド。

もう checkout のタイポで移動できない,なんて無くしましょう。gc で十分です。
また,GitHub では issue 駆動の開発をしていますが,issues/ は 7 文字です。i で十分です。
以下をコピペし,些細な工夫でモチベーションが下がるのを防ぎましょう。

.zshrc
# g: git
alias g='git'

# gc: checkout
alias gc='git checkout'
fuction gci (){ git checkout issues/$@ }

# gcb: checkout with a new branch
alias gcb='git checkout -b'
function gcbi (){ git checkout -b issues/$@ }

# gpr: pull the PR branch
function gpr (){ git fetch upstream pull/$@/head:pr/$@ && git checkout pr/$@ }

# gp: push
alias gp='git push'
alias gpo='git push origin'
function gpoi (){ git push origin issues/$@ }
5
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
2