Domanda

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?

È stato utile?

Soluzione

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"

Altri suggerimenti

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top