SlideShare a Scribd company logo
Learn Version Control with Git
Understanding Diffs in Git
What a Diff Is
<div id="headerContainer">	
- <h1>Imprint</h1>	
+ <h1>Imprint / Disclaimer</h1>	
</div>
Diffs visualize modifications…
…by comparing two versions of a file.
How to Read a Diff
How to Read a Diff
Part I: The Basics
<div id="headerContainer">	
- <h1>Imprint</h1>	
+ <h1>Imprint / Disclaimer</h1>	
</div>	
!
!
<span>	
- <a name=“top”>Home</a>	
</span>	
!
!
<li>Products</li>	
+ <li>Contact Us</li>	
+ <li>About Us</li>	
</ul>
lines from version A of the file = “-“
lines from version B of the file = “+“
a diff doesn’t show all of a file
but only the changed parts 

(= “chunks”)
some unchanged lines surround the
change to provide a bit of context
How to Read a Diff
Part I: The Basics
desktop apps like Tower also use
colors (in addition to +/-) for clarity
How to Read a Diff
Part II: The Details
How to Generate Diffs in Git
$ git log -p	
!
!
$ git diff	
!
!
$ git diff master..develop	
!
!
$ git diff 10a23e..fcd619
commit history with the “-p” flag
includes “patch” (= diff) in the output
unstaged local changes
in your working copy
compare branch “master”
with “develop”
compare revision “10a23e”
with “fcd619”
Learn Git with our free online book on
www.git-tower.com/learn

More Related Content

PPTX
Why Aren't You Using Git Flow?
PDF
Branch to branch by Photis Patriotis
ODP
Git Flow - An Introduction
PDF
Git flow
PPTX
Git workflows
PPTX
Git tutorial git branches 20131206-Bryan
PPTX
Git flow
PPT
Git workflows
Why Aren't You Using Git Flow?
Branch to branch by Photis Patriotis
Git Flow - An Introduction
Git flow
Git workflows
Git tutorial git branches 20131206-Bryan
Git flow
Git workflows

What's hot (20)

PPT
Git workflows presentation
PDF
Git flow Introduction
PDF
Git workflows
PDF
Git Series. Episode 3. Git Flow and Github-Flow
PDF
Git-flow workflow and pull-requests
PDF
Web development, from git flow to github flow
PPTX
My Git workflow
PDF
Introduction to git flow
PDF
Git work flow
PPTX
Background info on git / github
PDF
How We Use GitHub
PPTX
Bitbucket
PDF
Git and git flow
PDF
Bitbucket and Git
PDF
Git & gitflow
PPTX
Git and GitFlow branching model
ODP
Making Juice With GitHub
PDF
GitHub
PPTX
Git & Github
PDF
Git workflows presentation
Git flow Introduction
Git workflows
Git Series. Episode 3. Git Flow and Github-Flow
Git-flow workflow and pull-requests
Web development, from git flow to github flow
My Git workflow
Introduction to git flow
Git work flow
Background info on git / github
How We Use GitHub
Bitbucket
Git and git flow
Bitbucket and Git
Git & gitflow
Git and GitFlow branching model
Making Juice With GitHub
GitHub
Git & Github
Ad

Similar to Understanding Diffs in Git (20)

PDF
devops-complete-notes-2.pdf
PPTX
Do you git it
PDF
Git talk
PPTX
How different are different diff algorithms in Git?
PDF
Download full ebook of Version Control With Git Jon Loeliger instant download...
PDF
Version Control With Git Powerful Tools And Techniques For Collaborative Soft...
PDF
GIT_Overview.
KEY
Getting Git
PPTX
Git and github fundamentals
PPT
PPTX
Introduction to Git
PDF
HPLN Meet Git - Public
PDF
AP slides - Spring 1403 - Workshop Team
PDF
Professional Git 1st Edition Brent Laster
PDF
Do You Get Git?
PDF
Git Learn Version Control With Git A Stepbystep Ultimate Beginners Guide Hutten
PDF
Git Makes Me Angry Inside
PPTX
GIT INTRODUCTION
PPTX
git.pptx
PPTX
Gitflow - Branching and Merging Flow for Git
devops-complete-notes-2.pdf
Do you git it
Git talk
How different are different diff algorithms in Git?
Download full ebook of Version Control With Git Jon Loeliger instant download...
Version Control With Git Powerful Tools And Techniques For Collaborative Soft...
GIT_Overview.
Getting Git
Git and github fundamentals
Introduction to Git
HPLN Meet Git - Public
AP slides - Spring 1403 - Workshop Team
Professional Git 1st Edition Brent Laster
Do You Get Git?
Git Learn Version Control With Git A Stepbystep Ultimate Beginners Guide Hutten
Git Makes Me Angry Inside
GIT INTRODUCTION
git.pptx
Gitflow - Branching and Merging Flow for Git
Ad

Recently uploaded (20)

PDF
PTS Company Brochure 2025 (1).pdf.......
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
top salesforce developer skills in 2025.pdf
PPTX
L1 - Introduction to python Backend.pptx
PPTX
Essential Infomation Tech presentation.pptx
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
System and Network Administration Chapter 2
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PPTX
Introduction to Artificial Intelligence
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
Understanding Forklifts - TECH EHS Solution
PTS Company Brochure 2025 (1).pdf.......
Odoo POS Development Services by CandidRoot Solutions
top salesforce developer skills in 2025.pdf
L1 - Introduction to python Backend.pptx
Essential Infomation Tech presentation.pptx
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Odoo Companies in India – Driving Business Transformation.pdf
VVF-Customer-Presentation2025-Ver1.9.pptx
System and Network Administration Chapter 2
Design an Analysis of Algorithms II-SECS-1021-03
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
2025 Textile ERP Trends: SAP, Odoo & Oracle
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Softaken Excel to vCard Converter Software.pdf
How to Choose the Right IT Partner for Your Business in Malaysia
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Introduction to Artificial Intelligence
Which alternative to Crystal Reports is best for small or large businesses.pdf
How Creative Agencies Leverage Project Management Software.pdf
Understanding Forklifts - TECH EHS Solution

Understanding Diffs in Git

  • 1. Learn Version Control with Git Understanding Diffs in Git
  • 2. What a Diff Is <div id="headerContainer"> - <h1>Imprint</h1> + <h1>Imprint / Disclaimer</h1> </div> Diffs visualize modifications… …by comparing two versions of a file.
  • 3. How to Read a Diff
  • 4. How to Read a Diff Part I: The Basics <div id="headerContainer"> - <h1>Imprint</h1> + <h1>Imprint / Disclaimer</h1> </div> ! ! <span> - <a name=“top”>Home</a> </span> ! ! <li>Products</li> + <li>Contact Us</li> + <li>About Us</li> </ul> lines from version A of the file = “-“ lines from version B of the file = “+“ a diff doesn’t show all of a file but only the changed parts 
 (= “chunks”) some unchanged lines surround the change to provide a bit of context
  • 5. How to Read a Diff Part I: The Basics desktop apps like Tower also use colors (in addition to +/-) for clarity
  • 6. How to Read a Diff Part II: The Details
  • 7. How to Generate Diffs in Git $ git log -p ! ! $ git diff ! ! $ git diff master..develop ! ! $ git diff 10a23e..fcd619 commit history with the “-p” flag includes “patch” (= diff) in the output unstaged local changes in your working copy compare branch “master” with “develop” compare revision “10a23e” with “fcd619”
  • 8. Learn Git with our free online book on www.git-tower.com/learn