/github-for-non-tech

How to check which files were changed in a commit?

Learn how to check changed files in a commit with step-by-step Git commands—from using git log and git show to GitHub’s web interface.

Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.

Book a free No-Code consultation

How to check which files were changed in a commit?

 

Step 1: Open your terminal or Git Bash

 

Before running any Git commands, you need a terminal on your system:

  • Windows: open Git Bash or Command Prompt if Git is in your PATH.
  • macOS/Linux: open the built-in Terminal.

 

Step 2: Navigate to your local repository

 

Change the working directory to the folder where your Git repository is located.

cd /path/to/your-repo

Replace /path/to/your-repo with the actual path on your machine.

 

Step 3: View the commit history to identify the target commit

 

Use git log to list recent commits along with their SHAs, authors, dates, and messages:

git log --oneline

You’ll see output like:


a1b2c3d Fix typo in README
e4f5g6h Add user authentication
i7j8k9l Update styles for header

Copy the SHA (e.g., a1b2c3d) of the commit you want to inspect.

 

Step 4: List changed files with git show --name-only

 

Once you have the commit SHA, you can display which files changed in that commit:

git show --name-only a1b2c3d

This prints the commit details followed by a list of file paths that were added, modified, or deleted.

 

Step 5: See file change stats with git diff --stat

 

To view a summary of insertions and deletions per file, run:

git diff --stat a1b2c3d^! 

Example output:


 README.md        | 10 +++++++---
 src/app.js       |  5 +++--
 src/styles.css   | 12 ++++++++++--
 3 files changed, 19 insertions(+), 8 deletions(-)

 

Step 6: Drill down into specific file diffs with git show

 

If you want to inspect the specific line changes in each file, simply run:

git show a1b2c3d

This shows the full diff of added (+) and removed () lines.

 

Step 7: Use git diff-tree for scripting

 

For automation or scripts, git diff-tree can output only filenames in machine-readable format:

git diff-tree --no-commit-id --name-only -r a1b2c3d

Or to include change types (A = added, M = modified, D = deleted):

git diff-tree --no-commit-id --name-status -r a1b2c3d

 

Step 8: Check changed files on GitHub’s web interface

 

  • Go to github.com, sign in, and navigate to your repository.
  • Click on the “Commits” link or tab.
  • Find the commit in the list and click its SHA or message.
  • On the commit page, select the “Files changed” tab to see a list and diff of every changed file.

 

Step 9: Filter changed files by pattern

 

If you want to see changes only for certain file types (e.g., .js files), combine with grep:

git show --name-only a1b2c3d | grep ".js$"

This limits the output to JavaScript files only.

Want to explore opportunities to work with us?

Connect with our team to unlock the full potential of no-code solutions with a no-commitment consultation!

Book a Free Consultation

Client trust and success are our top priorities

When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.

Rapid Dev was an exceptional project management organization and the best development collaborators I've had the pleasure of working with. They do complex work on extremely fast timelines and effectively manage the testing and pre-launch process to deliver the best possible product. I'm extremely impressed with their execution ability.

CPO, Praction - Arkady Sokolov

May 2, 2023

Working with Matt was comparable to having another co-founder on the team, but without the commitment or cost. He has a strategic mindset and willing to change the scope of the project in real time based on the needs of the client. A true strategic thought partner!

Co-Founder, Arc - Donald Muir

Dec 27, 2022

Rapid Dev are 10/10, excellent communicators - the best I've ever encountered in the tech dev space. They always go the extra mile, they genuinely care, they respond quickly, they're flexible, adaptable and their enthusiasm is amazing.

Co-CEO, Grantify - Mat Westergreen-Thorne

Oct 15, 2022

Rapid Dev is an excellent developer for no-code and low-code solutions.
We’ve had great success since launching the platform in November 2023. In a few months, we’ve gained over 1,000 new active users. We’ve also secured several dozen bookings on the platform and seen about 70% new user month-over-month growth since the launch.

Co-Founder, Church Real Estate Marketplace - Emmanuel Brown

May 1, 2024 

Matt’s dedication to executing our vision and his commitment to the project deadline were impressive. 
This was such a specific project, and Matt really delivered. We worked with a really fast turnaround, and he always delivered. The site was a perfect prop for us!

Production Manager, Media Production Company - Samantha Fekete

Sep 23, 2022