Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (19.4k points)

This is a strange problem I'm observing in my IntelliJ. The show-diff always compare the current local version with the same old commit of git which is NOT the latest commit. Ideally, it should compare it with the latest commit. If the file was created after that commit then the error is "Not a valid object name ". To bypass this problem I have to RightClick->Git->Compare with and then select the latest version. Any clue what could be the issue? I have tried to search this commit id in the IntelliJ project folder but I couldn't find any. Also updated the Git CMD to the latest version but no relief.

1 Answer

0 votes
by (12.4k points)

Here to dhow diff for a file from local changes, IntelliJ calls

git log -n1 HEAD -- <path/to/file>

to get hash of the latest revision and to get file content

git cat-file -p <hash>:<path/to/file>

Want to learn more about DevOps? Check out: DevOps Course

Browse Categories

...