How to list file in compare current HEAD to previous commit hash without displaying the complete difference

Issue

I’m currently on HEAD after pulling thousands of files with huge diffs. In pull and merge, we can get the summary of changed files (not the one with + and -, but just the list of changed file).

Is there a command to compare current HEAD with any hash commit and show only the name of files that is changed (I want to know what files is deleted by the latest pull to be precise).

_

NOTE: This is after I close the terminal after the pull, and I want to read again what is the deleted files. Using git diff is too heavy and make VSCode crash. GitHub commit diff also make my tab freeze.

Related to How can I see what has changed in a file before committing to git?

Solution

Is there a command to compare current HEAD with any hash commit and show only the name of files that is changed

I would do this by saying

git diff --stat <other-hash>

Once you learn to read the output it’s tremendously informative, yet extremely compact; it’s just a list of files and what was done to them.

An even more compact rendering that you might like better is

git diff --compact-summary <other-hash>

However, if you don’t want even that much info, then you can say

git diff --name-only <other-hash>

But that is just a list of names; it gives you no idea what happened for each file.

Answered By – matt

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published