Using Git, version 1.9.3, on Fedora, version 20, I repeatedly run into the problem that I cannot commit an empty bar
file without making Git think that I deleted the previously versioned, non-empty foo
file. Both files happen to live in the same folder. My commands to add and commit the empty bar
file look like:
ls
# bar foo
file bar foo
# bar: empty
# foo: ASCII text
git status --short -- .
# ?? bar
git add --intent-to-add --verbose bar
# add 'bar'
git diff --cached -- .
# diff --git c/bar i/bar
# new file mode 100644
# index 0000000..e69de29
git commit --message=bar
# [master 1234567] bar
1 file changed, 44 deletions(-)
delete mode 100644 foo
git status --short -- .
# AM bar
# A foo
file bar foo
# bar: empty
# foo: ASCII text
Have you got an explanation for Git's behavior that I observe? Any solution?