A diff is a formatted display of the differences between two sets of files. Git displays diffs like this:
diff --git a/report.txt b/report.txt index e713b17..4c0742a 100644 --- a/report.txt +++ b/report.txt @@ -1,4 +1,4 @@ -# Seasonal Dental Surgeries 2017-18 +# Seasonal Dental Surgeries (2017) 2017-18 TODO: write executive summary.
- The command used to produce the output (in this case,
diff --git). In it,
bare placeholders meaning “the first version” and “the second version”.
- An index line showing keys into Git’s internal database of changes. We will explore these in the next chapter.
+++ b/report.txt, which indicate that lines being removed are prefixed with
-, while lines being added are prefixed with
- A line starting with
@@that tells where the changes are being made. Here, the line shows that lines 1-4 are being removed and replaced with new lines.
- A line-by-line listing of the changes with
-showing deletions and
+showing additions. (We have also configured Git to show deletions in red and additions in green.) Lines that haven’t changed are sometimes shown before and after the ones that have in order to give context; when they appear, they don’t have either
-in front of them.
You have been put in the
dental repository. Use
git diff data/northern.csv to look at the changes to that file. How many lines have been changed?