View the Change History of a File Using Git Versioning

Better Stack Team
Updated on June 24, 2024

To view the change history of a file using Git versioning, you can use the git log command with the --follow option followed by the filename. This will show the commit history of the file, including renames.

Here's the command:

 
git log --follow <file>

Replace <file> with the name of the file for which you want to view the change history.

Additionally, you can use other options with git log to customize the output. For example, you can use --oneline for a more concise output, --stat to see statistics about changes in each commit, or --graph to visualize the commit history as a graph.

For a more detailed view, you can also use a graphical Git client like GitKraken, Sourcetree, or GitHub Desktop, which often provide easier ways to explore the commit history of individual files and visualize changes over time.

Got an article suggestion? Let us know
Explore more
Git
Licensed under CC-BY-NC-SA

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.