" with the identifier (hash) of the first commit, and "" with the identifier of the second commit. The "--name-only" option tells Git to only display the names of the files that changed, rather than the complete diff output. For example, if you want to see the names of the files that changed between the latest commit and the one before it, you would run: git diff --name-only HEAD^ HEAD This will display a list of the names of the files that were modified, added, or deleted in the latest commit, compared to the previous commit." />

How to list only the names of files that changed between two commits

In this article you will learn that how you can find difference between two commits and get name of changed file between two commits. List Only the Names of Files that Changed Between Two Commits

 

How to List Only the Names of Files that Changed Between Two Commits?

To list only the names of files that changed between two commits, you can use the following Git command:

 

git diff --name-only <commit1> <commit2>

 

Replace "<commit1>" with the identifier (hash) of the first commit, and "<commit2>" with the identifier of the second commit. The "--name-only" option tells Git to only display the names of the files that changed, rather than the complete diff output.

 

For example, if you want to see the names of the files that changed between the latest commit and the one before it, you would run:

 

git diff --name-only HEAD^ HEAD

This will display a list of the names of the files that were modified, added, or deleted in the latest commit, compared to the previous commit.


Tags:

git

Share: