user360
user360

Reputation: 340

How to list all new files added or deleted in git repo from last one week commits

I am not too much familiar with git commands. Is there a way to list only newly added or deleted files in git in last one week?

Upvotes: 2

Views: 285

Answers (1)

Bertrand Martel
Bertrand Martel

Reputation: 45352

You can use --diff-filter and show added files (A) & deleted files (D) between your working tree & a specific commit :

git diff --name-only --diff-filter=AD  <commit sha>

You can also get the oldest commit sha since 7 days using :

git log --reverse --since=7.days --format="%H" | head -1 

So you can endup with the following to list added & deleted files since 7 days :

git diff --name-only --diff-filter=AD $(git log --reverse --since=7.days --format="%H" | head -1)

Upvotes: 3

Related Questions