How to see which files were changed in last commit

You can try git log --stat

Here --stat will display the number of insertions and deletions to each file altered by each commit.

Example: Below commit added 67 lines to the Demo.java file and removed 38 lines:

commit f2a238924456ca1d4947662928218a06d39068c3
Author: X <[email protected]>
Date: Fri May 21 15:17:28 2020 -0500
Add a new feature
Demo.java | 105 ++++++++++++++++++++++++-----------------
1 file changed, 67 insertion(+), 38 deletions(-)

Get all changed files since last commit

git diff --name-only HEAD HEAD~1

You can do this in a number of ways. This is what I came up with without looking into docs.

$ git log -1 --name-only

commit 3c60430b752bca26bd3c80604df87ffb2ae358 (HEAD -> master, origin/master, origin/HEAD)
Author: Name Surname <[email protected]>
Date:   Mon Apr 2 18:17:25 2018 +0200

    Example commit

.gitignore
README
src/main.c

Or:

$ git log -1 --name-only --oneline

commit 3c60430 (HEAD -> master, origin/master, origin/HEAD) Example commit
.gitignore
README
src/main.c

Or:

$ git log -1 --stat --oneline

commit 3c60430 (HEAD -> master, origin/master, origin/HEAD) Example commit
.gitignore |  2 ++
README     |  8 ++++++++
src/main.c | 12 ++++++++++++
3 files changed, 22 insertions(+)

Tags:

Git