読み方のヒント

矢印ボタン(または ← → キー)でページを移動できます。

第1節 今の状態を読む

1.2 git statusを読む

git status は、3つの場所の違いを表示します。

cd ~/git-practice/ch1
git status
On branch main
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
	modified:   README.md

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   products.csv
見出し意味
Changes to be committedステージにある変更。次のコミットに入る
Changes not staged for commit作業中のファイルにだけある変更
Untracked filesGitがまだ記録の対象にしていない新しいファイル
nothing to commit, working tree clean3つの場所がすべて同じ

括弧の中の use "..." は、その状態から戻す方法の案内です。第2節では、この案内にある操作を使います。

短い表示がほしいときは -s を付けます。

git status -s
M  README.md
 M products.csv

左の列がステージ、右の列が作業中のファイルの状態です。M は変更(modified)、?? は記録の対象外のファイル、A は新しく追加したファイルを表します。

3 / 36