Reputation: 1391
The dir structure of my project looks like this:
/home
----- data -> /path/to/another/folder
----- .git/
----- .gitignore
----- folder1
----- folder2
The .gitignore
file contains:
/home/data
data
(a link to another folder) currently appears as an untracked file. I thought by adding it to .gitignore
I could get git to stop following it altogether but it doesn't seem to be working as expected. How do I get data
to stop showing up in untracked files?
Upvotes: 2
Views: 233
Reputation: 165576
The .gitignore file contains:
/home/data
Entries in .gitignore
are relative to the repository, not absolute locations on your disk. It doesn't matter to Git where the repository is stored. From Git's perspective, the structure of your project is this.
/
data -> /path/to/another/folder
.gitignore
folder1
folder2
So you want to tell Git to ignore /data
.
The leading slash says to only ignore data
at the top of the repository. folder1/data
will not be ignored.
The lack of a trailing slash is important. If there was a trailing slash git
would look for a directory, not a symlink to a directory.
Upvotes: 4