git - support for symlinks in git commands (as IntelliJ needs it)

1.1k Views Asked by At

I use Linux so I have no problems with storing symlinks in git repository. But I have problem with commands with symlinks. I have files tree like following:

.
├── Module
│   └── file.txt
└── Project
    └── Module -> /full/path/to/repository/Module

When I try to execute any git command I get an error, for example:

git blame Project/Module/file.txt
fatal: no such path 'Project/Module/file.txt' in HEAD

Is there a way to force git to support that correctly? I am asking because in IntelliJ when I want to annotate file (right click on left bar) it shows me an error as my project uses symlinks.

1

There are 1 best solutions below

3
On BEST ANSWER

Git doesn't track content hidden behind a symlink. It'll track what's in the symlink, the path you stored, but if you want it to talk to git about what's at that path you'll have to use its path directly.