Last Updated: February 25, 2016
·
244
· g3rcar

Git: Get the edited file names between commits

Someday, I had to update the production environment with some code that I had been working/testing, but after a lot of commits, I didn't remember which files were modified.
After some of researching, I find out a very easy way to get it.

The first you have to know is the SHA of the first commit before you start editing files (or the last push to the production environment) and the SHA of the last commit or merge.
You can find them with this command

$ git log

You can take the first eight letters or the complete SHA.
When you have them, the command to know your edited files is this

$ git diff --name-only {SHA1} {SHA2}

Where the SHA1 is the first commit and the SHA2 is the last commit

1 Response
Add your response

This is really useful if you deploy w/Git and would like to see a summary of the deployed changeset.

In my post-receive hooks, I always add a:

git diff --name-only HEAD^..HEAD
over 1 year ago ·