Show Menu
Cheatography

Getting Started With Git Cheat Sheet (DRAFT) by

Version Control Systems

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Centra­lized Version Control Systems - p. 11

Single server contains all versioned files
Several clients check out from central server
Centra­lized server represents single point of failure

Distri­buted Version Control Systems - p. 12

Clients don't just check out the latest snapshot of the files
Every clone is really a full backup of all the data.

What is Git - p. 14

Snapshots
takes picture of what all files look like when commiting and stores a reference to that snapshot
 
If files have not changed, only the previously saved file is linked
Local Operations
operations only need local files and resources
 
entire history of the project on local disk
 
work can be continued when offline
Integrity
files are checks­ummed and then referred to by that checksum
 
SHA-1 hash is used for checks­umming
SHA-1 hash
40-cha­racter string composed of hexade­cimal characters
 
calculated based on the contents of a file or directory
 
everything in Git database saved by hash value of its contents
Adding data
actions only add data to database
 
once committed data loss is very difficult

The three states of files - p. 16

Modified
file changed but not committed to database yet
Staged
modified file is marked to go into next commit snapshot
Committed
data is safely stored in local database

Main Sections of a git project - p. 17

Working tree
single checkout of one project version
Staging area
file with inform­ation about next commit
Repository
metadata and object database
 

Installing Git - p. 18

Most official build for Windows is available for download on the Git website
Git for Windows is separate from Git itself

git config - p. 21

get and set config­uration variables that control all aspects of how Git looks and operates
global config file
values applied to every user on the system and all their reposi­tories
 
git config --system
user config file
values specific to user
 
git config --global
local config file
file of current repository
 
git config --local
When looking for a config­uration value, Git will start at the local level and bubble up to the system level.
View settings
git config --list --show­-origin

First Time Setup - p. 22

name
git config --global user.name "John Doe"
email
git config --global user.email johndo­e@e­xam­ple.com
editor
git config --global core.e­ditor emacs
branch name
git config --global init.d­efa­ult­Branch main
settings
git config --list
specific values
e.g. git config user.name
Git might read same config­uration variables value from more than one file. Having unexpected values is possible.

Getting Help - p- 24

git help <ve­rb>
command for seeing manpage
git <ve­rb> --help
equivalent command
git <ve­rb> -h
overview of available options for git commands