简体   繁体   中英

git is ignoring restored deleted file

Before anybody asks, there is NO .gitignore here

I had two files: foo1.tex and foo2.yaml

I did git rm foo1.tex foo2.yaml; git commit -m 'yada yada' rm foo1.tex foo2.yaml; git commit -m 'yada yada'

Kept on working...

Then things changed and I needed those files back:

git checkout long_rev_id^ -- foo1.tex
git checkout long_rev_id^ -- foo2.yaml

git status shows only the yaml file, so I went ahead and committed that one

But git can't seem to even see the foo1.tex file. git status foo1.tex doesn't show anything about the file I asked about. Adding -v doesn't help.

I tried to add it with every switch I could think of, and git pretends it's not even there.

By the way, the file is there and I can read it. It doesn't seem to be permissions.

I removed the .gitignore file, so that shouldn't be an issue.

git check-ignore -v foo1.tex shows nothing

Does git hate .tex files? ;-)

Why would git refuse to acknowledge the file?

I'm guessing it's something to do with the fact that it had been deleted, but that doesn't explain why one file worked as expected.

How can I find out more about what git knows about this file?

I'm running git 2.17.0 in Cygwin on Windows 10, 64bit (NTFS)

OK, I'm an idiot.

Apparently I failed to actually delete the file the first time. So git thinks it's still OK and ignores it.

User error... :-(

Thanks to everyone that offered help

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM