Viewing Modified Files

We just looked at the--onelineflag 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 --statIntro

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

Two Terminal applications side-by-side. The left one shows the result of thegit logcommand with all of the information while the right one shows the result of thegit log --statcommand which lists the files that were changed as well as the number of added/removed lines.

QUESTION 2 OF 4

Using what you've learned so far aboutgit logand 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--statflag displays. How many lines of code were_deleted_inindex.htmlin the commit with the SHA8d3ea36?

  • 2 lines

  • 4 lines

  • 9 lines

  • 13 lines

  • 28 lines

SUBMIT

git log --statRecap

To recap, the--statflag is used to alter howgit logdisplays 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

results matching ""

    No results matching ""