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

What's hot

Git workflows presentation
Git workflows presentationGit workflows presentation
Git workflows presentation
Mack Hardy
 
Git flow Introduction
Git flow IntroductionGit flow Introduction
Git flow Introduction
David Paluy
 
Git workflows
Git workflowsGit workflows
Git workflows
Sergiu Savva
 
Git Series. Episode 3. Git Flow and Github-Flow
Git Series. Episode 3. Git Flow and Github-FlowGit Series. Episode 3. Git Flow and Github-Flow
Git Series. Episode 3. Git Flow and Github-Flow
Mikhail Melnik
 
Git-flow workflow and pull-requests
Git-flow workflow and pull-requestsGit-flow workflow and pull-requests
Git-flow workflow and pull-requests
Bartosz Kosarzycki
 
Web development, from git flow to github flow
Web development, from git flow to github flowWeb development, from git flow to github flow
Web development, from git flow to github flow
Caesar Chi
 
My Git workflow
My Git workflowMy Git workflow
My Git workflow
Rui Carvalho
 
Introduction to git flow
Introduction to git flowIntroduction to git flow
Introduction to git flow
Knoldus Inc.
 
Git work flow
Git work flowGit work flow
Git work flow
Kevin Chiu
 
Background info on git / github
Background info on git / githubBackground info on git / github
Background info on git / github
btopro
 
How We Use GitHub
How We Use GitHubHow We Use GitHub
How We Use GitHub
NYC DevShop
 
Bitbucket
BitbucketBitbucket
Bitbucket
Okba Mahdjoub
 
Git and git flow
Git and git flowGit and git flow
Git and git flow
Fran García
 
Bitbucket and Git
Bitbucket and GitBitbucket and Git
Bitbucket and Git
Mohit Shukla
 
Git & gitflow
Git & gitflowGit & gitflow
Git & gitflow
Nolifelover Earn
 
Git and GitFlow branching model
Git and GitFlow branching modelGit and GitFlow branching model
Git and GitFlow branching model
Pavlo Hodysh
 
Making Juice With GitHub
Making Juice With GitHubMaking Juice With GitHub
Making Juice With GitHub
Mis Tribus
 
GitHub
GitHubGitHub
GitHub
ThomasLai27
 
Git & Github
Git & GithubGit & Github
Git & Github
Aman Lalpuria
 
Github
GithubGithub

What's hot (20)

Git workflows presentation
Git workflows presentationGit workflows presentation
Git workflows presentation
 
Git flow Introduction
Git flow IntroductionGit flow Introduction
Git flow Introduction
 
Git workflows
Git workflowsGit workflows
Git workflows
 
Git Series. Episode 3. Git Flow and Github-Flow
Git Series. Episode 3. Git Flow and Github-FlowGit Series. Episode 3. Git Flow and Github-Flow
Git Series. Episode 3. Git Flow and Github-Flow
 
Git-flow workflow and pull-requests
Git-flow workflow and pull-requestsGit-flow workflow and pull-requests
Git-flow workflow and pull-requests
 
Web development, from git flow to github flow
Web development, from git flow to github flowWeb development, from git flow to github flow
Web development, from git flow to github flow
 
My Git workflow
My Git workflowMy Git workflow
My Git workflow
 
Introduction to git flow
Introduction to git flowIntroduction to git flow
Introduction to git flow
 
Git work flow
Git work flowGit work flow
Git work flow
 
Background info on git / github
Background info on git / githubBackground info on git / github
Background info on git / github
 
How We Use GitHub
How We Use GitHubHow We Use GitHub
How We Use GitHub
 
Bitbucket
BitbucketBitbucket
Bitbucket
 
Git and git flow
Git and git flowGit and git flow
Git and git flow
 
Bitbucket and Git
Bitbucket and GitBitbucket and Git
Bitbucket and Git
 
Git & gitflow
Git & gitflowGit & gitflow
Git & gitflow
 
Git and GitFlow branching model
Git and GitFlow branching modelGit and GitFlow branching model
Git and GitFlow branching model
 
Making Juice With GitHub
Making Juice With GitHubMaking Juice With GitHub
Making Juice With GitHub
 
GitHub
GitHubGitHub
GitHub
 
Git & Github
Git & GithubGit & Github
Git & Github
 
Github
GithubGithub
Github
 

Similar to Understanding Diffs in Git

HTML by Telerik Akademy
HTML by Telerik AkademyHTML by Telerik Akademy
HTML by Telerik Akademy
Ognyan Penkov
 
Git Survival Tips: How to Undo and Recover from Your Mistakes
Git Survival Tips: How to Undo and Recover from Your MistakesGit Survival Tips: How to Undo and Recover from Your Mistakes
Git Survival Tips: How to Undo and Recover from Your Mistakes
Perforce
 
Git
GitGit
Git
GitGit
Git
GitGit
git.ppt
git.pptgit.ppt
git.ppt
ssuser10dcd71
 
git2.ppt
git2.pptgit2.ppt
git2.ppt
ssusered2ec2
 
Git Tutorials Git vs GitHub.pptx
Git Tutorials Git vs GitHub.pptxGit Tutorials Git vs GitHub.pptx
Git Tutorials Git vs GitHub.pptx
DevOps University
 
Getting Git
Getting GitGetting Git
Getting Git
Brian Arnold
 
Preview guide inotes9.0
Preview guide inotes9.0Preview guide inotes9.0
Preview guide inotes9.0
helade01833
 
Html
HtmlHtml
What is HTML- d3brand.com
What is HTML- d3brand.comWhat is HTML- d3brand.com
What is HTML- d3brand.com
Dremy Riyad
 
HTML5 introduction
HTML5 introductionHTML5 introduction
HTML5 introduction
Kaali Kiran Thammanna
 
Html ppt
Html pptHtml ppt
Html ppt
sanjay joshi
 
Git 101 - An introduction to Version Control using Git
Git 101 - An introduction to Version Control using Git Git 101 - An introduction to Version Control using Git
Git 101 - An introduction to Version Control using Git
John Tighe
 
Version Control System - Git
Version Control System - GitVersion Control System - Git
Version Control System - Git
Carlo Bernaschina
 
Basics tags for HTML
Basics tags for HTMLBasics tags for HTML
Basics tags for HTML
vidyamittal
 
HTML Fundamentals
HTML FundamentalsHTML Fundamentals
HTML Fundamentals
BG Java EE Course
 
3 1-html-fundamentals-110302100520-phpapp02
3 1-html-fundamentals-110302100520-phpapp023 1-html-fundamentals-110302100520-phpapp02
3 1-html-fundamentals-110302100520-phpapp02
Aditya Varma
 
Git 101 for Beginners
Git 101 for Beginners Git 101 for Beginners
Git 101 for Beginners
Anurag Upadhaya
 

Similar to Understanding Diffs in Git (20)

HTML by Telerik Akademy
HTML by Telerik AkademyHTML by Telerik Akademy
HTML by Telerik Akademy
 
Git Survival Tips: How to Undo and Recover from Your Mistakes
Git Survival Tips: How to Undo and Recover from Your MistakesGit Survival Tips: How to Undo and Recover from Your Mistakes
Git Survival Tips: How to Undo and Recover from Your Mistakes
 
Git
GitGit
Git
 
Git
GitGit
Git
 
Git
GitGit
Git
 
git.ppt
git.pptgit.ppt
git.ppt
 
git2.ppt
git2.pptgit2.ppt
git2.ppt
 
Git Tutorials Git vs GitHub.pptx
Git Tutorials Git vs GitHub.pptxGit Tutorials Git vs GitHub.pptx
Git Tutorials Git vs GitHub.pptx
 
Getting Git
Getting GitGetting Git
Getting Git
 
Preview guide inotes9.0
Preview guide inotes9.0Preview guide inotes9.0
Preview guide inotes9.0
 
Html
HtmlHtml
Html
 
What is HTML- d3brand.com
What is HTML- d3brand.comWhat is HTML- d3brand.com
What is HTML- d3brand.com
 
HTML5 introduction
HTML5 introductionHTML5 introduction
HTML5 introduction
 
Html ppt
Html pptHtml ppt
Html ppt
 
Git 101 - An introduction to Version Control using Git
Git 101 - An introduction to Version Control using Git Git 101 - An introduction to Version Control using Git
Git 101 - An introduction to Version Control using Git
 
Version Control System - Git
Version Control System - GitVersion Control System - Git
Version Control System - Git
 
Basics tags for HTML
Basics tags for HTMLBasics tags for HTML
Basics tags for HTML
 
HTML Fundamentals
HTML FundamentalsHTML Fundamentals
HTML Fundamentals
 
3 1-html-fundamentals-110302100520-phpapp02
3 1-html-fundamentals-110302100520-phpapp023 1-html-fundamentals-110302100520-phpapp02
3 1-html-fundamentals-110302100520-phpapp02
 
Git 101 for Beginners
Git 101 for Beginners Git 101 for Beginners
Git 101 for Beginners
 

Recently uploaded

E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
Hornet Dynamics
 
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfRevolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Undress Baby
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
Hornet Dynamics
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
TheSMSPoint
 
DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
Gerardo Pardo-Castellote
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
What is Augmented Reality Image Tracking
What is Augmented Reality Image TrackingWhat is Augmented Reality Image Tracking
What is Augmented Reality Image Tracking
pavan998932
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
Peter Muessig
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 

Recently uploaded (20)

E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
 
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfRevolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
 
DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
What is Augmented Reality Image Tracking
What is Augmented Reality Image TrackingWhat is Augmented Reality Image Tracking
What is Augmented Reality Image Tracking
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 

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