Signup/Sign In

Git Whatchanged

Git Whatchanged is a command that is used to view the commits that we have made to our repository. It gives us information about each commit like the commit hash, the commit message, the date and time of a commit, and who made the commit. It also tells us about the files that are a part of some commit It is essentially a way of asking Git what has changed in our repository.

Git Whatchanged Command

Git Whatchanged is a fairly straightforward command. We can use it as it is and it will display all the commits that were made. One thing to note here is that Git Whatchanged will exclude all the merge commits.

$ git whatchanged

We can use the -p flag along with Git Whatchanged to see the differences made to the files that were part of the commit. It gives an output that is similar Git Diff but the commit information is also displayed.

$ git whatchanged -p

We can also use the --since option to get the information for just a few of the previous commits. For example, the following code will get the commits made in the last one hour.

$ git whatchanged --since="1 hour ago"

Git Whatchanged vs Git Log

Git Whatchanged was an ancient command and has been replaced by the newer Git Log command. It can still be used and does the same job as the Git Log except for a few minor differences.

One of them is that Git Whatchanged will not display merge commits. But we can achieve the same result by using the Git Log command along with the --no-merges option.

Difference in whatchanged and log when a merge commit is added

Another difference is that Git Whatchanged will also display the name of the files that were part of the commit without using any additional options. But once again Git Log can also be used to do the same thing but we will have to use the --raw along with it.

Absence of file name in Git Log command and it is displayed in Git Whatchanged.

We can get the same output as the Git Whatchanged command by using the Git Log command with the --no-merges and --raw options.

$ git log --raw --no-merges 


Git Whatchanged is a command that lets us view the history of commits that were made in our repository. It has been replaced with the new Git Log command but can still be used. The Git documentation also suggests using the Git Log command instead of the Git Whatchanged command but it all boils down to personal preference. Developers who learned about the Git Whatchanged command first tend to use it more than the Git Log command.

About the author:
I like writing content about C/C++, DBMS, Java, Docker, general How-tos, Linux, PHP, Java, Go lang, Cloud, and Web development. I have 10 years of diverse experience in software development. Founder @ Studytonight