【Git】 現在のワークツリーの状態確認:git status (深堀)
タダのメモ
目次
本文
1. 説明
statusもう少し深堀する。
> git status
【git status 実行例】
git statusをオプションなしで実行すると、かなり文字数の多い結果となる。
> git status -s
【git status -s 実行例】
-sオプションで実行すると、簡易的な結果表示となる。
(Mマークの意味はだいたいわかるでしょ。その他に、「A(Add)」「D(Del)」「R(Rename)」)
> git status -sb
【git status -sb 実行例】
さらに-bオプションも合わせてみるとブランチ情報も合わせて表示される。
2. 実行例
◆ワークツリーのファイルを編集した状態
※Mの文字色がRed。
◆ステージに上げてから確認
※Mの文字色がGreen。
◆コミットしてから確認
※Branchにahead記載有。(pushが必要と分かる)
◆pushしてから確認
念のため、statusを確認。
$ git status On branch master Your branch is up to date with 'origin/master'. nothing to commit, working tree clean
綺麗な状態。