2016-07-19 2 views
1

.git 디렉토리의 .info 안에있는 제외 파일에서 파일을 무시하는 패턴을 추가했습니다.git 오류 - git이 (가) 알고있는 파일이 있습니까?

patter : httpdocs/**/bak_*.* 

내가 httpdocs에서 커밋하면 작동하고 변경된 디렉토리에서 오류가 발생합니다.

git commit -m "formatting js" httpdocs/* [working] 

git commit -m "formatting js" httpdocs/dir1/dir2/* [giving below error] 

오류 : pathspec는 'httpdocs/DIR1/DIR2/bak_admin.abc.php'자식에게 알려진 모든 파일을 일치하지 않습니다.

기본적으로 나는 이것이 왜 일어나고 있는지 알고 싶습니다.

답변

2

와일드 카드 패턴은 껍질 (이 아니라)로 확장되었습니다. 모든 파일이 이미 추적 된 경우 git commit -m "formatting js" httpdocs/*을 의미

git commit -m "formatting js" httpdocs/fileorDir1 
git commit -m "formatting js" httpdocs/fileorDir2 
git commit -m "formatting js" httpdocs/fileorDir3 

에 의해 번역됩니다, 자식이 작품을 커밋합니다. 그렇지 않은 경우, 본 오류 메시지가 리턴됩니다. bak_admin.abc.php을 포함하여 명시 적으로 (전혀 추적되지) 무시 된 파일을 포함 할 것이다 그

git commit -m "formatting js" httpdocs/dir1/dir2/fileirDir1 
git commit -m "formatting js" httpdocs/dir1/dir2/fileirDir2 
git commit -m "formatting js" httpdocs/dir1/dir2/fileirDir3 

: git commit -m "formatting js" httpdocs/dir1/dir2/*의 경우

, 즉는 다음과 같이 변환됩니다. .gitignore를 제대로 설정하더라도
, 쉘은 (하지 이눔)

error: pathspec 'httpdocs/dir1/dir2/bak_admin.abc.php' did not match any file(s) known to git. 

솔루션의 결과로, git commit 명령에 bak_admin.abc.php을 전달합니다 :

git commit -m "formatting js" httpdocs/ 
git commit -m "formatting js" httpdocs/dir1/dir2/ 
+0

'*'를 사용하지 않는 맞습니다. 그러나'.gitignore'가 올바르게 설정 되었다면, git-commit은 그 파일 경로를 무시해야합니다. – Vidur

+1

@Vidur 아니요.이 파일은 쉘에 의해 명시 적으로 git 커밋으로 전달되기 때문에 해당 파일을 무시하지 않습니다. – VonC

+0

죄송합니다. 그것에 대해 불평을합니다. – Vidur

관련 문제