프로젝트 작업 시 로컬 환경의 정보나 빌드 정보 등, 원격 저장소에 관리하지 말아야 되는 파일들에 대해 지정하여 원격 저장소에 실수로 올리가지 않도록 관리하는 파일
작성 패턴
- '#'로 시작하는 라인은 무시한다.
- 표준 Glob 패턴을 사용한다.
- 슬래시(/) 시작하면 하위 디렉토리에 적용되지 않는다.
- 디렉토리는 슬래시(/)를 끝에 사용하는 것으로 표한한다.
- 느낌표(!)로 시작하는 패턴의 파일은 무시하지 않는다.
Example
# ignore all .class files
*.class
# exclude lib.class from "*.class", meaning all lib.class are still tracked
!lib.class
# ignore all json files whose name begin with 'temp-'
temp-*.json
# only ignore the build.log file in current directory, not those in its subdirectories
/build.log
# specify a folder with slash in the end
# ignore all files in any directory named temp
temp/
# ignore doc/notes.txt, but not doc/server/arch.txt
bin/*.txt
# ignore all .pdf files in the doc/ directory and any of its subdirectories
# /** matches 0 or more directories
doc/**/*.pdf
'Git' 카테고리의 다른 글
이미 push한 commit 메시지 변경 (0) | 2022.02.09 |
---|---|
Git-Commit Message Convention (0) | 2021.07.31 |
git 초보를 위한 fork, pull request 방법 (0) | 2021.06.15 |