Question

I have one directory named "ignore-folder" and I track it in git, but I want to ignore the files and directories in it, how should I edit the .gitignore?

Was it helpful?

Solution

Add a .gitignore to the directory that you want to be tracked, ignoring all files inside that dir.

Like so

# Ignore everything in this directory
*
# Except this file
!.gitignore

or if you want to be more specific, eg only csv files

*.csv

Also check ".gitignore exclude files in directory but not certain directories"

OTHER TIPS

if you want to track the folder itself, but not the files in the folder, you should edit the .gitignore to say yourdirectoryname/*

If you want to ignore the directory as well, you can write yourdirectoryname/ in the .gitignore

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top