2012-08-23 5 views
1

저는 Git을 통해 관리하는 Lemonstand 사이트를 구축하는 중입니다. 따라서, 나는 다음과 같은 .gitignore 규칙을 사용하고 있습니다 :.gitignore 규칙이 작동하지 않습니다.

# Lemonstand 
.htaccess 
php.ini 
boot.php 
index.php 
install.php 
/config/* 
/controllers/* 
/init/* 
/logs/* 
/phproad/* 
/temp/* 
/uploaded/* 
/installer_files/* 
/modules/backend/* 
/modules/blog/* 
/modules/cms/* 
/modules/core/* 
/modules/session/* 
/modules/shop/* 
/modules/system/* 
/modules/users/* 
# add content_*.php if you don't want erase client changes to content 

/modules/gallery/* 
/modules/lddevel/* 
/modules/tweak/* 

(상단 블록 I got from github을, 두 번째 블록과 내가 Lemonstands 업데이트 시스템에 문제를 피하기 위해 자신을 추가 몇 가지 추가 규칙 인).

내 문제는 Lemonstand에 사용자 정의 인보이스를 추가한다는 것입니다. Lemonstand에 짧게 자르면 폴더와 일부 파일을 이라고하는 /modules/shop/invoice_templates/ 내에 추가해야합니다. 이 기본 Lemonstand에 추가하기 때문에

, 나는이 자식과 추적 싶어, 그래서 내 gitignore 파일의 맨 아래에 다음과 같은 규칙을 사용하려고 해요 : 때

!/modules/shop/invoice_templates/cm_standard/* 

그러나 git add -A을 실행하면 해당 디렉토리 내의 파일을 선택하지 않습니다. 나는 git add modules/shop/invoice_templates/cm_standard/*을하더라도 그것은 나에게 말한다 : 더 내가 제대로 규칙을 작성하지했습니다 제안

The following paths are ignored by one of your .gitignore files: 
modules/shop/invoice_templates 
Use -f if you really want to add them. 
fatal: no files added 

을 - 누군가가 도와 드릴까요? 고맙습니다. /modules/shop/* 효과적으로은 !/modules/shop/invoice_templates/cm_standard의 내용을 보이더라도 전에 디렉토리 탐색에서 /modules/shop/invoice_templates/ 전체를 치기, !/modules/shop/invoice_templates/cm_standard/*보다 우선 순위를 복용 귀하의 경우 있도록

+0

'!/modules/shop/invoice_templates/cm_standard /'가 더 잘 작동할까요? (마지막''* ''없이) – VonC

+0

@VonC - 시도해도 작동하지 않았습니다. cm_standard는 파일이 아닌 디렉토리입니다. 원래 질문에서 명확하게 설명했는지 확신 할 수 없기 때문에 결국 *를 얻었습니다. –

+0

디렉토리 내용을 무시하고 싶을 때는''*' '이 필요하지 않습니다 : 모든''*''를 제거하고 더 잘 작동하는지 확인하십시오. (각 디렉토리에 대해 마지막 '/'를 유지하십시오.) – VonC

답변

1

은 더 많은 경로 세그먼트와 패턴보다 우선 할 수 적은 경로 세그먼트와 패턴을 무시 . 그렇다고해서 순서가 중요 할 수도 있습니다. 그렇다면 순서가 바뀌면 직관적으로 나중에 파일 내의 규칙이 이전 규칙보다 우선합니다.

이 질문은 How do gitignore exclusion rules actually work?과 매우 유사하므로 읽어 보시기 바랍니다. debugging rules - 지난 몇 개월 동안 git에 추가했고, 며칠 전에 출시 된 버전 1.8.2에 방금 나타 났을 때 check-ignore 하위 명령이 유용 할 수도 있습니다.

관련 문제