3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

よく使うGitコマンドを短縮!別名を付ける

Last updated at Posted at 2021-02-05

Gitコマンドに少しずつ慣れてくると、git commitや、git checkoutは文字数多く感じて面倒くさくなってきますよね…
そんなときは、短い別名を付けておくと、コマンド入力が楽になって作業が捗ります!

別名の設定方法

ターミナル
git config --global alias.ci commit
git config --global alias.br branch
git config --global alias.co checkout
git config --global alias.st status

設定後、git ci とコマンド入力するだけで、 git commitと同じように使えるようになります!

  • git config とは、設定を変更するコマンド
  • alias(エイリアス)とは、別名のこと
  • --globalを付けると、PC全体の設定になる。もし --global を付けないと、今自分がいるプロジェクトの下の .git/config ファイルのほうに設定が反映される(特定のプロジェクトで使いたいというよりも、コマンドを短くして便利にしたいだけの場合は、PC全体の設定にするのがオススメ!)
# git commitと同じことができている
$ git ci
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean
# git statusと同じことができている
$ git st
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean

簡単ですが以上です!
読んでいただき、ar

3
1
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
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?