Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
foo.txtそれがインデックスにあると仮定します。
foo.txt
なぜ行うのか:
git reset foo.txt
1を返します:
$ echo $? 1
?
git reset foo.txtfoo.txtリセット後にステージングされていない変更がない場合はゼロを返し、リセットが行われた場合は1を返します。
これにより、スクリプトコードは、問題のファイルが最後のコミット以降に変更されているかどうかを判断できます。