LoginSignup
9
8

More than 5 years have passed since last update.

gitのコマンドが長くてダルいので、 .zshrc と .gitconfig を使って短縮する。

Posted at

今、LOUPEという会社でインターンやってて、GitHubのお世話になりまくりなんだけど、gitのコマンドって長くてダルいですよね。

というわけで、 .zshrc と .gitconfig に色々書いて少しでもタイプ数を減らしましょう。

.zshrcの設定

まずは ~/.zshrc からいじっていきましょう。
他のシェルを使ってる人は適宜読み替えてください。(たぶん一緒なので)

alias g=git

まずはコレ。
今まで

git commit -m "Commit message"

みたいにやってたのが、

g commit -m "Commit message"

って感じにできるようになりました。

.gitconfig の設定

お次は ~/.gitconfig をいじりましょう。

[alias]
    st = status -sb
    df = diff
    co = checkout
    b = branch

こうしてやれば、

g co -b fix-hogehoge

g b -a

とかみたいに、タイプ数を減らすことができます。

べんり。

9
8
2

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
9
8