Viewing the version history

Introduction to Git

George Boorman

Curriculum Manager

The commit structure

Git commits have three parts:

  1. Commit

    • contains the metadata - author, log message, commit time
  2. Tree

    • tracks the names and locations of files and directories in the repo
    • like a dictionary - mapping keys to files/directories
  3. Blob
    • Binary Large OBject
    • may contain data of any kind
    • a compressed snapshot of a file's contents
Introduction to Git

Visualizing the commit structure

Diagram showing three commits, with the files committed shown as part of the tree, and each file linked to the blob of the last commit

Introduction to Git

Visualizing the commit structure

Diagram showing the first commits, linking to the report and mental health survey in the tree, which links to snapshots of each file's contents in the blob

Introduction to Git

Visualizing the commit structure

Diagram showing the first and second commits, with the second commit linking to the report, mental health survey, and summary statistics in the tree, where the report links to the blob of the previous commit and the other two files link to the blob of the second commit

Introduction to Git

Visualizing the commit structure

Diagram showing three commits, with the files committed linked to the tree, and each file linked to the blob of the last commit they were a part of

Introduction to Git

Git hash

Last commit: b22eb75a82a68b9c0f1c45b9f5a9b7abe281683a

  • Pseudo-random number generator—hash function

  • Hashes allow data sharing between repos

    • If two files are the same,
      • then their hashes are the same
    • Git only needs to compare hashes
Introduction to Git

Git log

git log
  • Shows commits from newest to oldest
commit ad8accfe94cb924444c488132bdef7c54b9bca68
Author: Rep Loop <[email protected]>
Date:   Wed Jul 24 07:48:27 2022 +0000

    Added reminder to cite funding sources.
:
  • Press space to show more recent commits
  • Press q to quit the log and return to the terminal
Introduction to Git

Let's practice!

Introduction to Git

Preparing Video For Download...