LoginSignup
1
1

【Git】エイリアス設定集

Last updated at Posted at 2024-03-26

はじめに

開発で多用するgitコマンドのエイリアス集です。
~/.gitconfigに直接記載するか、$ git config --global alias.** 'command'で自由にカスタマイズできるので、皆さんもぜひ。

エイリアス設定例

# ブランチの一覧
git config --global alias.br branch
# ブランチの移動
git config --global alias.co checkout
# ブランチの作成
git config --global alias.new 'checkout -b'
# 全変更をステージング
git config --global alias.stg 'add -A'
# ステージングの解除
git config --global alias.unstg 'reset HEAD --'
# メッセージ付きコミット
git config --global alias.com 'commit -m'
# 変更ファイル一覧(簡易表示)
git config --global alias.st 'status -sb'
# コミットログ参照(1行ずつ)
git config --global alias.ls 'log --oneline'
# コミットログ参照(1行ずつ,修正ファイル名表示)
git config --global alias.ll 'log --oneline --name-status'

(※ユーザ単位での設定)
gitを打つのすら面倒くさいという場合は、~/.bash_profileに直接記載してしまうのもよいでしょう。

~/.bash_profile
alias pull='git pull'
alias push='git push'
alias fpush='git push --force-with-lease'
alias fetch='git fetch'
1
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
1
1