0 votes
93 views

How do you find a list of files that have changed in a particular commit?

in Technology by (191k points)

1 Answer

0 votes

For this answer instead of just telling the command, explain what exactly this command will do.

To get a list file that has changed in a particular commit use the below command:

git diff-tree -r {hash}

Given the commit hash, this will list all the files that were changed or added in that commit. The -r flag makes the command list individual files, rather than collapsing them into root directory names only.

You can also include the below-mentioned point, although it is totally optional but will help in impressing the interviewer.

The output will also include some extra information, which can be easily suppressed by including two flags:

git diff-tree --no-commit-id --name-only -r {hash}

Here –no-commit-id will suppress the commit hashes from appearing in the output, and –name-only will only print the file names, instead of their paths.

by (191k points)

Related questions

0 votes
1 answer 21 views
0 votes
1 answer 35 views
0 votes
1 answer 24 views
24 views asked Jan 8 in Technology by JackTerrance (191k points)
0 votes
1 answer 18 views
0 votes
1 answer 20 views
0 votes
1 answer 23 views
23 views asked Nov 2, 2020 in Technology by JackTerrance (191k points)
0 votes
1 answer 23 views
0 votes
1 answer 18 views
18 views asked Nov 4, 2020 in General by JackTerrance (191k points)
0 votes
1 answer 16 views
16 views asked Nov 2, 2020 in Technology by JackTerrance (191k points)
0 votes
1 answer 18 views
0 votes
1 answer 11 views
0 votes
1 answer 22 views
...