Try this:
$ find * -type l -not -exec grep -q "^{}$" .gitignore \; -print >> .gitignore
Found it from:
Question
I am trying to get git to ignore a symlink, but it remains as "untracked" (even though the real link is ignored in the origin). I have seen two posts regarding, this, but the answers seem to be "don't add them" but I have to have them because it is the only way I can show images on my testing server without having to have duplicates.
And I can't just leave them as untracked, because there is the potential to add them, and when I accidentally added a symlink, it destroyed my originals (luckily, I was backed up).
The links I've found that are of no help:
Thanks for any help!
Solution
Try this:
$ find * -type l -not -exec grep -q "^{}$" .gitignore \; -print >> .gitignore
Found it from: