Skip to content
Search

Git:Ignore

lastmod 2026-02-24created 2014-02-169 edits

The .gitignore file is a reserved file that helps you manage which files are excluded from version control.

Categories

How to use

Patterns follow these rules:

  • Blank lines and lines starting with # are ignored.
  • Standard glob patterns are used.
  • A directory is indicated by a trailing slash (/).
  • Files matching a pattern that starts with an exclamation mark (!) are not ignored.

The **/ style syntax is available from 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

Lists exclusion patterns.

  • General: Common exclusions.
[Bb]uild
[Oo]bj
[Bb]in
*.o
[Dd]ebug*
[Rr]elease*
*.mode*
*.app
*.pyc
.svn
*.log
*.cpp.eep
*.cpp.elf
*.cpp.hex

IDE Setting

Exclusions needed when using an 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

Lists OS-specific special files.

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

Favorite site

author Zer0 sitemap