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.
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
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