LoginSignup
5
6

More than 3 years have passed since last update.

Gitでよく使うワンライナー

Last updated at Posted at 2018-12-25

現在のmasterを最新のものにした上でマージされたブランチは削除する

有用度: ★★★★★

sync = !git checkout master && git pull origin master && git fetch -p origin && git branch -d $(git branch --merged | grep -v master | grep -v '*')

現在の変更点をHEADのコミットに追加

有用度: ★★★★★

amend = commit --amend -C HEAD

.gitignoreに追加(なかったら作成)

有用度: ★★★★☆

ignore = "!f() { echo $1 >> \"${GIT_PREFIX}.gitignore\"; }; f"

使い方

git ignore [ignoreするファイル名]

簡易ステータスを表示

有用度: ★★★★☆

s = status --short --branch

全てのファイルをaddして簡易statusを表示

有用度: ★★★★☆

aa = !git add -A && git s

グラフログを表示

有用度: ★★★☆☆

lg = log --graph --date=short --decorate=short --pretty=format:'%C(yellow)%h %Cgreen%cd %Cblue%cn%Cred%d %Creset%s'

参考記事

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