To list only the names of files that changed between two commits in Git, you can use the git diff command with the --name-only option. Here's how you can do it:
Replace <commit1> and <commit2> with the commit hashes, branch names, or other references for the two commits you want to compare.
For example, to list only the names of files that changed between the commits referenced by their hashes abc123 and def456, you would run:
This command will output a list of file names, each on a separate line, representing the files that changed between the two specified commits.
Note:
- The
git diff --name-onlycommand is useful for obtaining a quick overview of the files that were modified, added, or deleted between two commits. - If you want to see the names of files that were modified, but not the exact changes made to them,
-name-onlyis the appropriate option to use. - You can also use other options with
git diffto customize the output, such as-name-statusto include the type of change (modified, added, deleted) orMto detect renames.
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.