Python for Entrepreneurs Transcripts
Chapter: Digging Further into Git
Lecture: The Git commit log

Login or purchase this course to watch this video and the rest of the course contents.
0:00 So far in this chapter, we've taken a look a lot of the commands
0:03 that allow you to add changes to the staging area,
0:06 commit your code, push those changes up to other repositories,
0:09 whether those are local or in the cloud.
0:11 As you start to accumulate all of these commits,
0:14 it's often useful to go back and look at what previous changes were made,
0:17 for example, the Full Stack Python repository has almost 2000 commits,
0:21 so if I want to see when I added a new page
0:23 or when I may have introduced some typos, I can just go back
0:27 with another command we'll introduce in this chapter, which is "git log".
0:30 Back on the command line, in our course demos repository let's run "git log".
0:34 What we're seeing are all the changes made in reverse chronological order,
0:38 by commit. If you press the space bar,
0:41 we'll continue to scroll through all the commits until we get to the original one,
0:46 which will be much further down.
0:49 What if we only want to see commits that have happened say this year,
0:52 we can use the "git log --after" and punch in the year, a month and a date,
0:59 and it will only give us the commits that have been made in 2017,
1:02 so this is much shorter list and we'll run out and get to the end pretty quickly.
1:07 so again that's a "git log --after", you can also use "before",
1:12 and then you punch in a date by the year, month and day.
1:17 And that will give you everything before or after a specific date.
1:21 When we use "git log", we are only seeing a short summary
1:24 with the author of the date and the commit message,
1:27 what if we want to see more detailed information about the specific files
1:31 that have changed, well, if we want to see all the details,
1:34 we can use the "git log -p" command,
1:38 and this will give us the low level changes,
1:40 every single one of them the difference between the old file and the new
1:43 that has changed in this specific commit, but this is pretty overwhelming,
1:48 so instead of using "git log -p" typically, most developers use the --stat argument.
1:56 This will give you at a glance all the files that have changed
1:59 and roughly how many changes were made to those files,
2:02 so this is much easier to scroll through and see what has changed
2:06 over the past few commits. Using "git log" without any arguments,
2:10 will give us the laundry list of the author, the date and the commit title
2:14 for every single commit, the -p flag will give us absolutely everything
2:18 about each commit, the --stat argument gives us a hybrid with all the files
2:24 that have changed, and if we want to see a really condensed version
2:27 of all of our commits, we can use the --oneline argument,
2:31 this is going to give us a very condensed version
2:34 of just the last seven hex digits in a commit,
2:39 and then the title for that commit, and you can see why commit messages
2:44 are so important, because eventually, you will have a laundry list
2:47 of these throughout the entire history of your project
2:50 and it's going to be really useful for you and anyone else that you're working with
2:53 to be able to see everything at a glance.
2:56 That is the "git log" command, and some of the common arguments
2:59 that you'll use after you start building up your commit history.