Skip to content

Chapter_1

Chris McIntosh edited this page Nov 20, 2019 · 4 revisions

1 - About Version Control

  • Version control systems save the history of changes to a file
    • Doesn't have to be Source Code
  • Distributed Version Control systems like Git fully mirror the entire repo in clients

2 - Git History

  • Developed by Linus Torvalds
  • Developed to be fully distributed and non-linear from start

3 - What is Git

  • Git stores data as snapshots of a mini file system
    • Most other (D)VCS's think of data as files with patches
  • Git operations are local unless explicitly targetting the server
  • Data is checksummed with SHA-1 and that checksum is used to determine if there are changes
  • As a general rule git is only additive, it rarely will remove data
  • Git files are in one of 3 states:
    • Modified
      • Changed but not committed to the database
    • Staged
      • Marked the current state of the file to go in to a commit
    • Committed
      • All marked changes have been saved to the local database
  • Working Tree
    • A single checkout of a version of the project
    • Decompressed to your file system on request
  • Staging area
    • Technical name is Index
    • A file in the .git repo that contains info on what is going into the next commit
  • Git directory
    • Contains metadata and the object database
    • The only thing that is copied when doing a clone

4 - The CLI

  • TL;DR Understand the command line

5 - Installing Git

  • brew install git
  • Skipping the rest...

6 - First Time Setup

  • Git can be configured with the git config tool or written to the config files
  • Config files are hierarchical, taking the "closest" relevent config
    • /etc/gitconfig
    • ~/.gitconfig
    • .git/config
  • git config --list --show-origin
    • View all settings and which file they were derived from
  • Important things to set
    • user.name
    • user.email
    • core.editor

7 - Getting Help

  • Three ways to get help
    • git help <verb>
    • git <verb> --help
    • man git-<verb>
    • git <verb> -h
      • short concise help text

8 - Summary

  • Useful commands from this chapter
    • git config --global <config.option> <value>
    • git help <verb>
    • git <verb> --help
    • man git-<verb>
    • git <verb> -h
  • Working tree is a single instance of a version checked out locally
  • Staging area is called the index and is a file in the .git repo with info about the next commit
  • .git directory contains metadata and the object database
  • Three states are:
    • Modified
    • Staged
    • Committed
  • Configure User name, email, and editor on a new install at minimum