I have a folder in my repository called 'activity'. It keeps getting strangely deleted from the repository, and isn't seen as an untracked file.
In github, it is rendered as a folder with a green arrow, and the text '→ f32111b' next to it. This has happened several times now, and only with this one folder.
I've already checked .gitignore. Is there another reason why a folder called 'activity' would be trouble in git?
Git does not delete empty folder but it has no concept of folders therefore it does not track folders (git only tracks paths to your files, not folders, it treats file paths like how you'd treat URLs on a website).
If you have deleted the file and already committed the changes, you need to use the ` git checkout` command to restore the file. First, you need to find out the checksum of the commit that deleted the file, and then check out the file from the previous commit.
git folder is ignored by default. All others are deamed potentially important for the source-base unless configured otherwise within the repository or at a global level.
Git doesn't ignore empty directories. It ignores all directories. In Git, directories exist only implicitly, through their contents. Empty directories have no contents, therefore they don't exist.
That's not a directory, that's a submodule. Or at least GitHub seems to think so.
What does your .gitmodules
file look like? Did you maybe forget to run git submodule init
and git submodule update
?
Submodules can be a little bit tricky, especially when you convert from a directory to a submodule or back.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With