/github-for-non-tech

How to view commit differences (diff) in GitHub?

Discover how to view GitHub commit differences easily. Follow step-by-step instructions to navigate commits, view diffs, filter changes, and compare branches.

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 view commit differences (diff) in GitHub?

 

Step 1: Navigate to Your GitHub Repository

 

  • Open your web browser and go to github.com.
  • Log in with your GitHub credentials if you haven’t already.
  • Click on your profile icon in the top-right corner and select Your repositories from the dropdown.
  • Select the repository you wish to explore by clicking its name.

 

Step 2: Go to the Commits Tab

 

  • Within your repository page, click on the “Code” tab if you’re not already there.
  • Locate and click on the Commits link or button. It’s usually above the file list or next to the branch selector.

 

Step 3: Select a Specific Commit

 

  • You will see a chronological list of commits, each showing a commit message, author, date, and a short SHA identifier.
  • Click on the commit message or SHA hash of the commit you want to inspect.

 

Step 4: View the Diff for That Commit

 

  • After clicking, the commit details page will load, showing changed files and the diff for each.
  • In the diff view:
    • Lines removed are highlighted in red with a “–” prefix.
    • Lines added are highlighted in green with a “+” prefix.
  • Scroll through the files to review all changes made in that commit.

 

Step 5: Filter and Search Within the Diff

 

  • Above the list of changed files, use the Filter files box to type a filename or path to narrow down displayed diffs.
  • Within an open diff, press Ctrl + F (or Cmd + F on macOS) to search for specific code snippets or keywords.

 

Step 6: Compare Two Branches, Tags, or Commits

 

  • To compare branches or tags, click on the Compare button (often labeled “Compare & pull request”) near the branch selector.
  • Select the base branch/tag and the compare branch/tag from the dropdowns.
  • GitHub will display a combined diff between the two points.

 

Step 7: Compare Specific Commits Using a Direct URL

 

  • You can construct a URL like this to compare two commit SHAs directly:
https://github.com/OWNER/REPO/compare/COMMIT_SHA1...COMMIT_SHA2
  • Replace OWNER, REPO, and the SHA placeholders with your actual values.

 

Step 8: View Diffs Locally with Git (Optional)

 

  • If you have the repository cloned locally, you can view diffs between commits using the command line:
git diff COMMIT_SHA1 COMMIT_SHA2
  • This shows the same red/green diff output in your terminal.

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