Reputation: 8704
I have added /build/
to my .gitingore
but whenever I do build, git
shows that my build
folder is untracked. I have following folder hierarchy
~/workspace/ProjectName/ ➤ 617a838|mainline⚡
1361 ± : tree -La 1 [6d1h6m] ✭
.
├── .DS_Store
├── .git
├── .gitignore
├── Config
├── build
├── build.xml
├── checkstyle.xml
├── configuration
├── src
└── tst
5 directories, 5 files
~/workspace/ProjectName/ ➤ 617a838|mainline⚡
1362 ± : git status [6d1h7m] ✭
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
build
nothing added to commit but untracked files present (use "git add" to track)
Here is content of .gitignore
/build/
/eclipse-bin/
one thing that i did notice is that .gitingore
is a hidden file. Does this even matter?
Upvotes: 1
Views: 75
Reputation: 38639
Your .gitignore
is fine for exculding a folder named build
directly besides the .gitignore
file and all its contents.
That the file is hidden is by definition. All files on *nix systems that start with a dot are considered hidden files and this does not interrupt the least.
That your ignore is not working is simply due to the fact that build
is not a folder, but a file. The git status
output says this at least and that is why the ignore is not working. If build
would be a folder with some trackable content inside, it would appear as build/
in git status
output, not as build
.
If build
actually is a symbolic link to another folder, that would also explain the situation, because a symbolic link is file that links to a folder, but is not a folder by itself. In that case you would need to exclude the file build
instead of the folder build
, or to be correct both, the file and the folder called build
, as you can fix the type to be a folder by appending a slash as last character, but you cannot fix the type to be a file. So if this is your situation, change /build/
to /build
and the symbolic link will be ignored.
Upvotes: 2