Problem
When opening a file inside a third-party dependency directory (for example, vendor/ for Composer-managed PHP projects, node_modules/ for npm projects, or similar locations populated by other package managers), the Annotate with Git Blame action is missing from the gutter context menu.
Steps to reproduce:
- Create a project with third-party code installed via a package manager. For example, with Composer:
mkdir example cd example composer require psr/log - Open the project in the IDE.
- Open a file inside the dependency directory, such as
vendor/psr/log/src/NullLogger.php. - Right-click in the gutter (line numbers area).
Annotate with Git Blame is not present in the menu.
Cause
Git blame requires access to a local Git repository to read commit history. Third-party code installed by package managers (Composer, npm, pip, Gradle dependency cache, and similar) does not include the upstream .git directory, so the IDE has no local source from which to compute blame.
Resolution
Adding remote-only Git blame for third-party code is tracked as IJPL-234197. Vote for and subscribe to the issue to receive updates.
In the meantime, look up the upstream history manually using the metadata stored by the package manager. For Composer, composer.lock records the source repository and exact commit reference for each package:
"name": "psr/log",
"version": "3.0.2",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
"reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3"
}
Open the repository URL in a browser and navigate to the file at the recorded commit, for example:
https://github.com/php-fig/log/commits/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3/src/NullLogger.php
Other package managers expose similar metadata: npm's package-lock.json stores resolved URLs and integrity hashes, and pip's wheels can be traced back to the project's repository via PyPI.
Comments
0 comments
Please sign in to leave a comment.