0
0

Git 操作の速度を上げる .gitconfig のエイリアス (秘伝のタレ)

Posted at

.gitconfig

[alias]
  # 普通のエイリアス
  ck = checkout
  br = branch
  st = status -s
  cm = commit

  # 現在のブランチを返す
  # 他のgitエイリアスに組み込むためのエイリアスで、直接は利用しない
  current = !git symbolic-ref --short HEAD

  # いまの作業状態で、てきとうなコミット名でコミットする
  # コミット名を考えたくない時に使う
  update = !git add . && git commit -m "update"

  # なにも変更差分がない状態でコミットを作ってpushする
  pr = "!sh -c 'git checkout -b $1 && git commit --allow-empty -m $1 && git push' -"

  # 今の作業内容で新規コミットを作る ( add + commit )
  create = !git add . && git commit
  cr = !git create

  # 今の作業内容をammendして反映する ( add + commit --amend )
  forget = !git add . && git commit --amend
  fg = !git forget

  # 現在のコミットを壊してコミット未反映状態にする
  break = reset HEAD^

  # コミットされていないものはすべて消す
  vanish = !git reset . && git checkout . && git clean -fd

  # rebaseでもmergeでもcherry-pickでもabortする
  abort = !git rebase --abort || git merge --abort | git cherry-pick --abort

  # rebaseの時の変更を反映する
  change = !git add . && git rebase --continue

  # 現在ブランチをリモート(origin)からpullする
  pull-from-origin = !git pull origin $(git current)

  po = pull-from-origin

  # 現在ブランチをリモート(origin)の最新の状態に書き換える
  reset-current = !git fetch && git reset --hard origin/$(git current)

  # localで現在のブランチ以外を全て削除する
  delete-branches = !git branch | xargs git branch -D

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

Twitter

0
0
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
0
0