CodeNewbie Community 🌱

Discussion on: How To Set Up .gitignore for Your JavaScript Project

Collapse
 
jacobvarney profile image
jacobvarney

This is great, thank you! I learned a little something about .gitignore yesterday that people might find useful.

Yesterday, I was making a .gitignore file for syncing my Obsidian configuration and folder structure across vaults. I learned two things that surprised me:

  • Git only tracks files, not folders. So, if I wanted to include a folder I needed to add a dummy file (which I just called .includedir)
  • You can "un-include" things you've ignored with the ! operator, but once you've excluded a whole folder, you can no longer "un-include" anything within. I was having a headache trying to include on the files in a directory until I learned that.

Basically, I wanted to use .gitignore like an "include" file, which is sort of hack-y.

Collapse
 
marcinwosinek profile image
Marcin Wosinek

Thanks for sharing! Yeah, it's a bit of a gotcha that Git doesn't store empty folders:)