0

I want to gitignore all files inside my public/images/Users/ directory but I want that path to be tracked on my repository so that other collaborators will not create new folders on their machines. I have this line on my .gitignore file public/images/Users/* but this line ignores all from images folder. What is the best way to achieve this? Thanks. By the way, my project is on Laravel framework.

Magnus Bäck
  • 10,963
  • 3
  • 43
  • 58
Jay Marz
  • 1,691
  • 8
  • 32
  • 49
  • Git doesn't track directories at all. They get created as needed to hold files. I have voted to close this question as a duplicate, as this has already been asked and answered dozens of times on SO. – Chris Dec 21 '14 at 20:56
  • possible duplicate of [How to track directories but not their files with Git?](http://stackoverflow.com/questions/5091017/how-to-track-directories-but-not-their-files-with-git) – Chris Dec 21 '14 at 20:56

1 Answers1

1

To illustrate the practice of adding placeholder files in folders you want cloned (but with an ignored content), consider that the laravel project uses an original variation of that technique:

See the laravel/app/storage/logs folder.

The .gitignore itself is the placeholder file which allows its parent folder to be versioned.

But its content is:

*
!.gitignore

It ignores every file within the logs folder, except for itself.

Community
  • 1
  • 1
VonC
  • 1,129,465
  • 480
  • 4,036
  • 4,755