문제

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