AnonBird
AnonBird

Reputation: 656

git file getting deleted again and again

I cloned a project and I can see using the Web UI that there are 3 files.

After cloning, I noticed I only got 2 files. I checked the branch and I'm on master and I should have 3 files.

Here is output of git status :

On branch master
Your branch is up-to-date with 'origin/master'.

Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        deleted:    con.js

no changes added to commit (use "git add" and/or "git commit -a")

But I didn't delete any file !

git ls-files --deleted : con.js

Ok, weird bug, I then try to restore the file that strangely got deleted while cloning so I type git checkout con.js.

After I type git checkout con.js, the full file get printed in the terminal. I suspect it gets deleted again immediatly. If I then type git ls-files --deleted, con.js it is still there and not restored !

What could I be possibly doing wrong ?

Upvotes: 2

Views: 145

Answers (1)

sbat
sbat

Reputation: 1888

Do not use the following reserved names for the name of a file:

CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9. Also avoid these names followed immediately by an extension; for example, NUL.txt is not recommended.

https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file

Git expectedly has many issues with files like aux.js, con.cpp, etc on Windows. Your best bet is to rename this file in the repo.

Upvotes: 7

Related Questions