How to Display Filenames Changed in All Commits
This article illustrates how to use the git log
command to show the filenames changed by commits in git. We aim to get the same output as the svn log -v
command.
Use git log
to Display Filenames Changed in All Commits
We use the git log
command to check the commit history in our repository. However, you can add the --name-only
option to show the full path names of the files affected by a commit.
Command:
$ git log --name-only
It is easier with the --oneline
flag if you have hundreds of commits.
Command:
$ git log --name-only --oneline
Output:
If we want to see the filenames and the status of the affected files, run the following command.
Command:
$ git log --name-status
Output:
The M
stands for modified while A
and D
stands for added and deleted, respectively. You can also run the git log --stat
for the diffstat
of the changed files.
Command:
$ git log --stat --oneline
Output:
Conclusion
You can format the git log
command to show the filenames of the affected files in a commit like the svn log-v
command. We have covered some variations of the command, which will format the output based on your needs.
John is a Git and PowerShell geek. He uses his expertise in the version control system to help businesses manage their source code. According to him, Shell scripting is the number one choice for automating the management of systems.
LinkedIn