J: Just citing the book - M: My conversion from theory to practice (2) - CR: Created - LU: Last Updated. (YYYY-MM-DD HH:MM:SS GMT).


"The cat-file command with the -p option prints the object given on the command line" ("Git's objects" section)


For a large project with thousands of files, I was interested in discovering which files within a directory were being tracked by my Git repository. My first step was to find the ID/SHA-1 of the directory, which was 7f21f0619053f44762c16a2707d845697e99a1f1. Then I ran the following command: git cat-file -p 7f21f0619053f44762c16a2707d845697e99a1f1. The result was the list of everything that was being tracked by Git, including both files and directories. Then I could conclude that anything that was present in that directory but that did not appear in the list returned by the command, was not being tracked by Git. CR: 2018-10-18 00:43:12 LU: 2018-10-18 00:47:29 Permalink: https://twitter.com/jaimemontoyacom/status/1077212516185456643


"How to do it...

1. The simplest way to see the history is to use the git log command; this will display the history in reverse chronological order. The output is paged through less and can be further limited, for example, by providing only the number of commits in the history to be displayed:

$ git log -3

2. This will display the following result:

commit 34acc370b4d6ae53f051255680feaefaf7f7850d
Author: John Doe <john.doe@example.com>
Date: Fri Dec 13 12:26:00 2013 +0100

This is the subject line of the commit message.

It should be followed by a blank line then the body, which is this text. Here
you can have multiple paragraphs etc. and explain your commit. It's like an
email with subject and body, so try to get people's attention in the subject

commit a90d1906337a6d75f1dc32da647931f932500d83
Author: John Doe <john.doe@example.com>
Date: Fri Dec 13 12:17:42 2013 +0100

Instructions for compiling hello_world.c

commit 485884efd6ac68cc7b58c643036acd3cd208d5c8
Merge: 44f1e05 0806a8b
Author: John Doe <john.doe@example.com>
Date: Fri Dec 13 12:14:49 2013 +0100

Merge branch 'feature/1'

Adds a hello world C program.
" ("Viewing the DAG, How to do it..." section)


I frequently use this command to see the history of the latest commits of the branch that I have currently checked out. CR: 2019-01-31 21:36:42 LU: 2019-01-31 21:36:42 Permalink: https://twitter.com/jaimemontoyacom/status/1091089169164759043

I want to hear from you!

Have you read this book? What is your experience applying to your life what you have learned from it? Would you recommend this book? What do you think about my conversions from theory to practice that I am sharing here? Any ideas about things that I should apply to my life from the lessons found in this book? Please share your comments at the end of this page. This site is boring without your participation!