سؤال

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?

هل كانت مفيدة؟

المحلول

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"

نصائح أخرى

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

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top