Viewing Modified Files
We just looked at the--oneline
flag to show one commit per line. That's great for getting an overview of the repository. But what if we want to dig in a little to see what file or files were changed by a commit?
QUESTION 1 OF 4
If you look in the repository at commita3dc99a
, it has the message "Center content on page".
What file or files were changed in this commit?
An HTML file
A CSS file
A JavaScript file
An HTML and CSS file
An HTML and JS file
There's no way to know for sure <--
SUBMIT
git log --stat
Intro
Thegit log
command has a flag that can be used to display the files that have been changed in the commit, as well as the number of lines that have been added or deleted. The flag is--stat
("stat" is short for "statistics"):
$ git log --stat
Run this command and check out what it displays.
QUESTION 2 OF 4
Using what you've learned so far aboutgit log
and its flags, how many files were modified in the commit with the SHA6f04ddd
?
1 file
2 files
9 files
10 files
SUBMIT
QUESTION 3 OF 4
You did so well with the first one, so here's another! How many files were modified in the commit with the SHA8d3ea36
?
1 file
2 files
3 files
5 files
SUBMIT
QUESTION 4 OF 4
Now it's time to look at the other info the--stat
flag displays. How many lines of code were_deleted_inindex.html
in the commit with the SHA8d3ea36
?
2 lines
4 lines
9 lines
13 lines
28 lines
SUBMIT
git log --stat
Recap
To recap, the--stat
flag is used to alter howgit log
displays information:
$ git log --stat
This command:
- displays the file(s) that have been modified
- displays the number of lines that have been added/removed
- displays a summary line with the total number of modified files and lines that have been added/removed