2014-10-22 1 views
4

이 답변을 보았습니다 : Unignore subdirectories of ignored directories in Git힘내 무시 unignore가 작동하지 않습니까?

그리고 제가 말할 수있는 한 똑같은 일을하고 있지만 git는 내 디렉토리/파일을 무시하지 않습니다.

이것은 내 규칙입니다. 나열된 디렉토리/하위 디렉토리를 가져 오려고하지만 공용 디렉토리 전체가 표시되지 않습니다.

/public/bootstrap/* 
!/public/bootstrap/bower_components/bootstrap/dist/* 
!/public/bootstrap/bower_components/bootstrap/dist/**/* 
!/public/bootstrap/bower_components/bootstrap/less/variables.less 

아이디어가 있으십니까?

+0

방금이 구조를 복제했으며'variables.less'는 무시되지 않았습니다. 그것을 잡을 수있는 또 다른'.gitignore'가 없다고 확신합니까? –

+0

전체 프로젝트 폴더에서 찾기를 수행했는데 다른 .gitignore는 다른 디렉토리에 있고 "local"만 있습니다. – Joren

답변

8

다음과 같이 할 수 있습니다. 문장 "You can't unignore more than one level deep per line"이 올바르지 않습니다. 당신은 대답 here을 참조 할 수 있습니다.

/public/bootstrap/** 
!/public/bootstrap/**/ 
!/public/bootstrap/bower_components/bootstrap/dist/** 
!/public/bootstrap/bower_components/bootstrap/less/variables.less 
+0

그래서이 권리를 읽고 있다면 첫 번째 줄은 모두 무시하고 두 번째 줄은 모든 디렉토리를 무시하고 세 번째 줄은 dist의 모든 파일과 디렉토리를 무시하지 않습니까? 그리고, 내가 이해한다면, 모든 폴더는 이제 무시되지 않지만, dist가 아닌 파일은 무시되므로 git은 아무 것도하지 않을 것입니다. – Joren

+0

@Joren 예, 그렇습니다. – Landys

+0

정말 멋지 네요. – starskythehutch

1

일부 읽기와 시행 착오를 많이 수행 한 후,이 작품 :

/public/bootstrap/bower_components/jquery 
/public/bootstrap/bower_components/bootstrap/** 
!/public/bootstrap/bower_components/bootstrap/dist/ 
!/public/bootstrap/bower_components/bootstrap/dist/** 
!/public/bootstrap/bower_components/bootstrap/less/ 
!/public/bootstrap/bower_components/bootstrap/less/variables.less 

문제는 문서에서이 선 것 같다 "재 포함 경우 파일을 할 수 없습니다 해당 파일의 상위 디렉토리는 제외됩니다. "

이것은 다른 답변과 직접적으로 모순되는 것처럼 보이지만 그것이 나를 위해 어떻게 작동하는지 나타납니다. 당신은 줄에 깊은 하나 개 이상의 수준을 무시 안함 수 없습니다

/public/bootstrap/* 

:이처럼 무시하면

내 테스트에서 나는 발견했다.

# doesn't work 
!/public/bootstrap/bower_components/bootstrap/ 

# works 
!/public/bootstrap/bower_components/ 
!/public/bootstrap/bower_components/bootstrap/