foldrr's weblog

旧ブログ http://d.hatena.ne.jp/foldrr/

Git ローカルの変更を確認する

git status で変更箇所が表示される。
git add していないファイルは "Changed but no updated:" として表示される。

$ echo 1 >> file1.txt
$ git status
# On branch master
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   a.html
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       .gitignore
no changes added to commit (use "git add" and/or "git commit -a")

git add したファイルは "Chanages to be committed:" として表示される。

$ git add file1.txt
$ git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       modified:   a.html
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       .gitignore

git add したファイルと、していないファイルが混在する場合は、別々に表示される。

$ echo 1 >> file1.txt
$ echo 1 >> file2.txt
$ git add file1.txt
$ git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       modified:   file1.txt
#
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   file2.txt
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       .gitignore