git status

git

書き方

git status [-sb] [-uall]

何がステージに載り、何がまだかを見せます。追跡外のファイルはフォルダー名にまとめられるので、一つずつ見るには-uallを付けます。

よく使うオプション

オプション意味
-sshort two-column format
-bshow the branch line, used as -sb
-ualllist untracked files one by one instead of folding folders
--ignoredalso list what .gitignore hides
-vappend the staged diff
--porcelainstable machine format for scripts

git status -sb

one line per change plus the branch and its upstream

git status -uall

names every untracked file inside new folders

git status --porcelain

output a script can parse without surprises

取り消しに何通りもあるのが混乱のもとです — ブランチの指す先を動かすのと、打ち消すコミットを積むのは別です。

読み方

  • 角括弧 [ ] は省いてよい部分です。
  • 三点 … は複数並べられるという意味です。
  • オプションは大文字小文字を区別します — -r と -R が別物のコマンドもあります。

よくある質問

Q. git status は何をしますか。

何がステージに載り、何がまだかを見せます。追跡外のファイルはフォルダー名にまとめられるので、一つずつ見るには-uallを付けます。

Q. どう打ちますか。

git status [-sb] [-uall] — 角括弧は省いてよい部分です。

Q. よく使うオプションはいくつですか。

ここにまとめたのは6個です。全部は man git にあります。このコマンドはgitの仲間です。

関連するコマンド

man ページ: man git-status