What is the command to view the commit history of a file?

What is the command to view the commit history of a file?

a) git log filename
b) git history filename
c) git show-log filename
d) git commit-log filename

Answer:

a) git log filename

Explanation:

The git log filename command shows the commit history of a specific file. It lists all commits that modified the file, allowing you to trace the evolution of that file through the project’s history.

This is useful for tracking changes made to a particular file, identifying when a bug was introduced, or understanding the file’s development history.

Using git log filename helps you analyze how and when specific changes were made to the file.

Reference:

Top 100 Git and GitHub MCQ Questions and Answers

Scroll to Top