0

Currently I've used git

I have this directory public/images/facility where all facility images are being stored.

What I want to do is, I want to push the project on new repo this directory public/images/facility

but not the images currently it contains.

How can I rule it on my gitignore file?

Because this directory contains huge amounts of images, But still I want my repo to recognize this dir public/images/facility

Pablo
  • 1,275
  • 1
  • 7
  • 28

1 Answers1

3

git does not store empty folders, so you need to store some file.

In your case, you can place a .gitignore file in this folder, with content :

# ignore all files except .gitignore :
*
!.gitignore

In some repos, you will see folders containing an empty file, by convention it is usually called .gitkeep

LeGEC
  • 35,975
  • 2
  • 46
  • 87
  • This is what I would do. Note: The `.gitkeep` convention is intended to put in place a folder structure that later will have files in them. At which point, the `.gitkeep` file should be deleted. – kinbiko Jul 04 '20 at 06:28