LoginSignup
5
4

More than 5 years have passed since last update.

覚えた使えるGitトリック _alias

Last updated at Posted at 2016-03-15

2016年 初春。
アルコール漬けのチンピラからプログラマに転身した私が覚えたトリックを備忘録兼ねてまとめるTips_ Git編


  • git config alias

gitのコマンドにエイリアスを設定。
これでgitコマンドが一文字とかで済むので、例えばgit statusgit stとかに短縮できる。

git config alias.st status

alias.使いたい短縮系 コマンド

で、aliasが設定できる。
さらに、zshとかにもエイリアスを作ってあげると、git自体も短縮できる。
vim ~/.zshrcで、設定ファイルに以下のように書いてあげる。


alias g="git"

とすると、git は gで済むので、例えばこんな感じに楽になります。

git grep hogehoge  => g g hogehoe
git status => g s
git checkout master => g co master
git branch => g b

最初はそんなに変わんねえだろ、手間。とか思っててごめんなさい。
慣れるとすげー便利。

5
4
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
4