2017-01-03 3 views
1

Laravel 5.3에서 gitignore에 문제가 있습니다.Laravel storage/app/mydir/myfile.json에서 무시하지 않는 방법

다음 gitignore 파일이 있습니다. !을 사용하여 myfile.json을 제외 시켰습니다. 내가 git status --ignored을 실행하면

node_modules/ 
public/storage 
storage/*.key 
/.idea 
Homestead.json 
Homestead.yaml 
.env 
SQL/ 
*.sql 
mynotes.md 
!storage/app/mydir/myfile.json 

나는이 출력을 얻을.

Ignored files: 
    (use "git add -f <file>..." to include in what will be committed) 

    ../.env 
    ../SQL/ 
    ../app/.DS_Store 
    ../bootstrap/cache/config.php 
    ../bootstrap/cache/services.php 
    ../mynotes.md 
    ../node_modules/ 
    uploads/.DS_Store 
    ../storage/app/.DS_Store 
    ../storage/app/mydir/ 
... 
... 

그래서 myfile.json은 무시됩니다. 어떻게 파일을 추가/커밋 할 수 있도록 gitignore를 작성할 수 있습니까?

답변

0

gitignore로 기억해야 할 규칙 :

It is not possible to re-include a file if a parent directory of that file is excluded.

은 그래서 우선 순위가됩니다, 그것은 (예를 들어)에 위치한 .gitignore 인 경우 때문에 실제로 /storage/app/에 직접 ../storage/app/mydir/을 무시 않는 .gitignore 규칙을 확인합니다. !storage/app/mydir/xxx 규칙을 적용하는 것은이 .gitignore 파일을 하나 개의 폴더에 최대에 있어야합니다 :

git check-ignore -v -- ../storage/app/mydir/myfile.json 

../은 현재 .gitignore가 올바른 위치에 있지 않은 것을 의미한다./* \t 저장/응용 프로그램/MYDIR : 1 :/응용 프로그램/.gitignore 저장/응용 프로그램/MYDIR/myfile.json 저장 -

+0

사실 그것은 내가 자식 체크인 무시 -v '에 의한 또 다른 gitignore을 발견 한 수준 아래이었다 myfile.json'. 그래서 저장소/app/dir에 다른 gitignore를 찾았습니다. 여기에 storage/app/mydir/myfile.json을 추가 할 수 있습니까? – shin

+0

예, 그 규칙을 추가하는 적절한 장소가 될 것입니다. – VonC

+0

감사합니다. BTW 내가 gitignore와'git status'를 수정할 때 myfile.json이 나타나지 않습니다. 먼저이 gitignore를 추가/커밋해야 효과가 있습니까? – shin