gitignore file for Go Projects

gitignore file for Go Projects

Get Social!

This is a gitignore file for a Go project to ensure temporary files and build files are not added to git repository commits.

# Binaries, plugins, libs
*.dll
*.dylib
*.exe
*.exe~
*.so

# Testing
*.test
*.tmp

gitignore file for Eclipse Projects

Get Social!

This is an example of a .gitignore file for an Eclipse project to ensure temporary files, build files and project settings are not added to repository commits.

See .gitignore for more info.

# Java related
target/**
*.jar
*.war
*.ear
*.class

# eclipse specific
*.pydevproject
.project
.metadata
bin/**
tmp/**
tmp/**/*
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

gitignore file for Nodejs Projects

Tags :

Category : Supporting Scripts

Get Social!

An example gitignore file for Nodejs projects to ensure that local environment variables, build related output and modules are not committed to the git repository.

See .gitignore for more info.

# NodeJS specific #
.nyc_output/
coverage/
node_modules/
npm-debug.log
package-lock.json
test/*.log

gitignore file for Netbeans Projects

Tags :

Category : Supporting Scripts

Get Social!

A gitignore file for most Netbeans projects to keep the build and local configuration files out of your git repository.

See .gitignore for more info.

# NetBeans specific #
nbproject/private/
build/
nbbuild/
dist/
nbdist/
nbactions.xml
nb-configuration.xml

# Class Files #
*.class

# Package Files #
*.jar
*.war
*.ear

.gitignore OS generated files

Tags :

Category : Supporting Scripts

Get Social!

A gitignore file to ignore standard OS (usually Windows) generated files. Often you’d use this in addition to a more technology specific gitignore set.

See .gitignore for more info.

# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.*.sw[op]
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

Ignoring Files and Directories in Git with .gitignore

Tags :

Category : How-to

Get Social!

octocat-githubWith Git you are able to define file exceptions to exclude certain files and folders from git repository commits. You can create files which contain a list of patterns which git will check against on each git add and ignore any matching files.

You can create ignore pattern lists to ignore files on either a global scale which will affect all repositories on the system or limit it to a specific repository.

Both types of ignore use a .gitignore file which contains literal paths of files inside the repository or patterns which will be used to exclude matching files and directories.

You can skip to the bottom of the post for a few common examples.

.gitignore patterns

Patterns inside the .gitignore file are matched from the root directory of the git repository. Patterns are comprised of a wildcard character *, to match any character, and literal characters to match the exact phrase.

A typical example of using a .gitignore file would be to exclude all files ending in .log. The below pattern would be added to the .gitignore file

*.log

Or, as with something like log4j, your log files may include numbers at the end. This pattern will exclude any file names that contain .log.

*.log*

Another use is to exclude all files in a specific path, such as the application build directory. This will ignore the Build directory and everything within it.

/Build/*

A double asterisk (**) has its own special meaning and represents matching in all directories. For example, a/*/c would only match a single folder between a and b – a/this/b would match but /a/this/and/this/b would not match. Using a double asterisk would match in both scenarios. 

/src/**/tmp # exclude any /tmp files or folders at any level in the /src/ folder.

Single repository .gitignore

Add your patterns to the below file to add exclusions to affect only a singe git repository. You must make sure you have changed to the root directory of your repository, or include it in the file path.

vi /path/to/repository/.git/info/exclude

Global .gitignore

You must run a git config command to enable .gitignore to work across all local repositories. You can edit the ~/.gitignore path if required.

git config --global core.excludesfile ~/.gitignore

Once enabled, edit the ~/.gitignore file and add patterns which will affect the next git add command.

vi ~/.gitignore

For example, you may add a global gitignore entry for .bak files. Add the following line to you global gitignore file:

*.bak

You can use just one of the above methods or a combination of both gitignore methods on your git client.

Common .gitignore examples


Visit our advertisers

Quick Poll

How often do you change the password for the computer(s) you use?

Visit our advertisers