GitNotes.5-12.md
본 문서는 Git Notes for Professionals (라이센스:CC-BY-SA) 를 한글로 번역한 문서입니다. 번역상 오류가 있을 수 있으므로 정확한 내용은 원본 문서를 참고하세요.

Section 5.12: .gitignore 파일에 의해 ignore 처리된 파일들 검색하기

현재 디렉토리에서 ignore 처리된 모든 파일들의 목록은 아래 명령어를 통해 조회할 수 있다:

git status --ignored

만약 아래와 같은 구조의 저장소를 가지고 있으며:

.git .gitignore ./example_1 ./dir/example_2 ./example_2

....gitignore 파일 내용이 아래와 같은 경우:

example_2

...아래 명령어에 대한 결과물은 다음과 같이 나올 것이다:

$ git status --ignored On branch master Initial commit Untracked files: (use "git add <file>..." to include in what will be committed) .gitignore .example_1 Ignored files: (use "git add -f <file>..." to include in what will be committed) dir/ example_2

만약 하부 디렉토리에 있는 ignore 처리된 파일들까지 재귀적 (recursively) 으로 모두 출력하고 싶다면, --untracked-files=all 파라미터를 추가하여야 한다.

해당 파라미터를 사용한 결과는 아래와 같다:

$ git status --ignored --untracked-files=all On branch master Initial commit Untracked files: (use "git add <file>..." to include in what will be committed) .gitignore example_1 Ignored files: (use "git add -f <file>..." to include in what will be committed) dir/example_2 example_2

[출처] https://books.goalkicker.com/GitBook/ (CC BY-SA)

반응형

+ Recent posts