Why “git reset <file>” returns 1?
-
23-04-2021 - |
Pregunta
Assume that foo.txt
is in the index.
Why doing:
git reset foo.txt
returns 1:
$ echo $?
1
?
Solución
git reset foo.txt
returns zero when foo.txt
has no unstaged changes after the reset, and one when it does.
This allows scripting code to determine if the file in question has been modified since the last commit.
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow