Reputation: 2190
One of my projects has a sub folder called "tags". As it looks like, this folder is ignored by git although I've not defined it in my .gitignore file.
So I guess there is a list of "keywords" like "tags" that is ignored by git on default?
Here is the content of the .gitignore file
# Java: https://github.com/github/gitignore/blob/master/Java.gitignore
*.class
**/classes/
# Package Files #
*.jar
*.war
*.ear
# IDEA: https://github.com/github/gitignore/blob/master/Global/IntelliJ.gitignore
*.iml
*.ipr
*.iws
.idea/
# Mac OS X: https://github.com/github/gitignore/blob/master/Global/OSX.gitignore
.DS_Store
.AppleDouble
Icon
# Thumbnails
._*
# Files that might appear on external disk
.Spotlight-V100
.Trashes
# Gradle
.gradle/
**/build/
out/
# Leiningen and others
**/target/
Upvotes: 3
Views: 3105
Reputation: 840
I wanted to keep the "tags" in .gitignore
but exclude only my directory
So I added this line:
# Auto-generated tag files
tags
!myproject/path/tags/
That last line excludes only my projects "tags" directory
Upvotes: 0
Reputation: 798
Use git check-ignore [FILE]
I hit the same idea like as the questioner, but it was not correct!
Check with the following method!
# for registered as ignore, show which file the definition is set in.
$ git check-ignore -v tags
/PATH/TO/DIR/.config/git/ignore:2:tags tags
$ git check-ignore -v no-registered-tags # for not registered, outputs nothing.
My condition
$ git --version
git version 2.10.0
Upvotes: 0
Reputation:
tags
is a good candidate for a global ignore rule because of its use by the ctags
command.
ctags
generates an index of identifiers in your source code and writes them to a file called tags
, which vi
uses to quickly jump to the definition of the identifier under your cursor when you press ^]
. For this reason, lots of source directories tend to contain a tags
file that is not of interest to version control.
Do you have a global ignore file set up? An answer to this question suggests:
git config --get core.excludesfile
to find out.
And reading further down the answers in that other question: also $XDG_CONFIG_HOME/git/ignore
and $HOME/.config/git/ignore
Upvotes: 9
Reputation: 15391
All files that are special (e.g. .gitignore
) to git have names beginning with .git
and except for the .git/
directory itself even these special files get tracked.
Do you have any files in your tags/
folder? Empty directories don't get tracked by git.
Additionally the file or a matching pattern could be defined in .git/info/exclude
. This is like the .gitignore
file but doesn't get tracked itself. I use that e.g. for ignoring temporary files from my editor.
Upvotes: 4
Reputation: 27305
Normally that should work if you have files inside the folder and the folder isn't ignored.
The function in git is tag so that should not make any problems. All git files are in the .git folder.
Upvotes: 1