GoTTimw
GoTTimw

Reputation: 2430

How to list files that have been created/removed between given commits

Is there an easy way to list files that have been added and/or removed from given branch between some arbitrary commits?

Upvotes: 3

Views: 46

Answers (2)

Shaun Luttin
Shaun Luttin

Reputation: 141452

Answer

git log 0be3204 61bd4f0 --diff-filter=AD --summary --oneline

Output

0be3204 Delete two files.
 delete mode 100644 test2.txt
 delete mode 100644 test3.txt
f7f92cc Add a new file
 create mode 100644 test3.txt
3bcb423 Delete one file.
 delete mode 100644 test.txt
61bd4f0 Create two files.
 create mode 100644 test.txt
 create mode 100644 test2.txt

Explanation

  • git log lists your commits.
  • 0be3204 61bd4f0 indicates the start and end commit range.
  • --diff-filter=AD means to show only files that were added/deleted. Use the D character alone to list only deleted files.
  • --summary describes newly added, deleted, renamed and copied files.
  • --oneline (optional) includes the SHA1 and the commit message in the result.

Upvotes: 4

wkschwartz
wkschwartz

Reputation: 3877

git diff --stat commit1..commit2

Upvotes: -1

Related Questions