Learning Git - for real.

Edit:
TLDR: Intro to git from the author of the Pro Git book.

What a difference 7 years makes: "Has anyone been to github?", indeed.


Git (noun) - a foolish or contemptible person.

Love it or hate it, it's the de-facto standard for most open-source and much closed-source development. 

This is the intro to Git that I wish I had 5 years ago. Or one year ago, or even 3 months ago.
"If you're comfortable with version control, and it's a version control system that is not git, you are going hate git. When you start using it, you will hate it, because it is very very different"







Notes to call out:


  • 12 verbs to do 99% of everything you'll do in git.
  • (Nearly) immutable, (almost) never removes data.
  • Previous gen (CVS) are are file-based delta storage. In git everything is checksummed "(c)hunks" or "blobs".
  • "Very simple DB, very simple structure, complex algorithms to do interesting things"
  • Working Directory = What's on your filesystem *right now*.
  • "Index" = Staging.
  • "git add" doesn't add a file, it adds the current content to index (to next commit), that is, when you "git add", it's a snapshot of file *when you added it*. You can add a file, delete it from Working Dir, then commit. Git-commit, by default, does not look at your working directory.
  • "Master" branch - isn't anything special, just default convention.
  • "HEAD is the parent of your next commit" Last known state of working dir.
  • Remote: "origin" is also just default convention
  • Recommends fetch-then-merge rather than pull. (I wonder if that still holds)
  • Understand that clone sets up tracking branches. I recommend doing at least one first time setup of a purely local repo, then add remote(s) as tracking.
  • Re-integration merges: Merge on-going changes from other branches (say, master) into your branch as you go along.
  • bash completion exists! (I had to install it on MacOS I think)

===

When all else fails: http://ohshitgit.com/

"Git is hard: screwing up is easy, and figuring out how to fix your mistakes is fucking impossible. Git documentation has this chicken and egg problem where you can't search for how to get yourself out of a mess, unless you already know the name of the thing you need to know about in order to fix your problem."




Comments