콘텐츠로 이동
Search

Git:Ignore

lastmod 2026-11-16created 2014-02-1610 edits

.gitignore파일은 버전관리 대상에서 제외될 파일을 관리할 수 있도록 도와주는 예약된파일이다.

Categories

How to use

패턴은 아래 규칙을 따른다:

  • 아무것도 없는 줄이나, #로 시작하는 줄은 무시한다.
  • 표준 Glob 패턴을 사용한다.
  • 디렉토리는 슬래시(/)를 끝에 사용하는 것으로 표현한다.
  • 느낌표(!)로 시작하는 패턴의 파일은 무시하지 않는다.

**/ 스타일의 문법은 Git 1.8.2 버전부터 사용할 수 있다.

Two consecutive asterisks ("**") in patterns matched against full pathname may have special meaning:

  • A leading "" followed by a slash means match in all directories. For example, "/foo" matches file or directory "foo" anywhere, the same as pattern "foo". "**/foo/bar" matches file or directory "bar" anywhere that is directly under directory "foo".
  • A trailing "/" matches everything inside. For example, "abc/" matches all files inside directory "abc", relative to the location of the .gitignore file, with infinite depth.
  • A slash followed by two consecutive asterisks then a slash matches zero or more directories. For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on.

Git ignore partten

예외 처리 패턴에 대하여 열거한다.

  • General: 일반적인 예외처리 방법.
[Bb]uild
[Oo]bj
[Bb]in
*.o
[Dd]ebug*
[Rr]elease*
*.mode*
*.app
*.pyc
.svn
*.log
*.cpp.eep
*.cpp.elf
*.cpp.hex

IDE Setting

IDE에 사용될 경우 필요한 예외처리 목록이다.

  • XCode IDE
*.pbxuser
*.perspective
*.perspectivev3
*.mode1v3
*.mode2v3
# XCode 4
xcuserdata
*.xcworkspace
  • Code::Blocks
*.depend
*.layout
  • Visual Studio
*.sdf
*.opensdf
*.suo
*.pdb
*.ilk
*.aps
ipch/
  • Eclipse
.metadata
local.properties
.externalToolBuilders

OS

OS별 특수파일 목록에 대하여 열거한다.

  • Linux
*~
# KDE
.directory
.AppleDouble
  • OSX
.DS_Store
*.swp
*~.nib
# Thumbnails
._*
  • Windows
# Windows image file caches
Thumbs.db
# Folder config file
Desktop.ini

Favorite site

  • Create useful .gitignore files for your project
  • Git의 매직 파일들 | GeekNews
    • [원문] Git’s Magic Files | Andrew Nesbitt
    • .git/ 안의 설정이 아니라 커밋되어 코드와 함께 다니며 Git 동작을 바꾸는 파일들을 정리한 글. .gitignore, .gitattributes, .lfsconfig, .gitmodules, .mailmap, .git-blame-ignore-revs, .gitmessage 등
    • Git 은 디렉터리별 .gitignore, 로컬 전용 .git/info/exclude, 전역 ignore 파일(~/.config/git/ignore 또는 core.excludesFile)을 차례로 확인함. .DS_Store·Thumbs.db 같은 OS 파일은 전역 쪽이 알맞음
    • .gitignore 는 추적하지 않는 파일에만 적용됨. 이미 추적 중인 파일은 git rm --cached 로 추적을 풀어야 함
    • 빈 디렉터리를 남기려고 넣는 .gitkeep 은 Git 기능이 아닌 관례이고 파일 이름도 임의임
author Zer0, MCPBot sitemap