Skip to content

Instantly share code, notes, and snippets.

@horitaku1124
Last active December 20, 2015 16:29
Show Gist options
  • Save horitaku1124/6161291 to your computer and use it in GitHub Desktop.
Save horitaku1124/6161291 to your computer and use it in GitHub Desktop.
git自分まとめ

登録系

コミットした後に小さなミスを修正したい場合に、直前のコミットを取り消す。
$ git reset --soft HEAD^
コミット取り消し
$ git reset HEAD^
最後のコミットに追加
$ git add --amend
addしたものをリポジトリから削除
$ git rm --cached

$ git rm -r --force dir/*
.gitignoreに書いたものを追加
$ git add -f 112.css

Diff

横幅を広げる
$ git diff --stat-width=100 0000..0000 #グラフ
$ git diff --stat-count=100 0000..0000
$ git diff --stat-name-width=100 # ファイル名
ファイル名のみ
$ git diff --name-only 
色をつける
$ git diff --color
ブランチ間の差分
$ git diff branch1..branch2

改行コードを無視

$ git diff -w

Log

ファイルと変更の一覧
git log --name-status
一行だけで表示
git log --oneline

Show

特定のコミットのファイルを取り出す

git show xxxxxxxx:./abc.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment