Skip to content

Instantly share code, notes, and snippets.

@eporama
Last active June 19, 2017 16:44
Show Gist options
  • Save eporama/25eeb7bed3f13b87820fcbc5b998e806 to your computer and use it in GitHub Desktop.
Save eporama/25eeb7bed3f13b87820fcbc5b998e806 to your computer and use it in GitHub Desktop.

Git — Beyond the Basics

So, now that we've all moved beyond the question of "Do I need to use a version control system?" and with the luster wearing off the Great Git Migration and the rise of projects being run on enterprise systems like Github, what's next?

I know that when I was learning git, there was a period of time when I felt "Okay, that wasn't too bad. I think I get this git thing". Then I had to manually deal with a nasty merge conflict, try to find one commit we did months ago in a dead branch, undo the commit a secure token to our repo, and on and on…

Git is phenomenal in its power to help both individuals and teams, but there's more to it than clone, pull, and push. The next "level" of commands often seem a bit more mysterious. I've heard many people say, "Well, just use 'rebase', or 'revert' or one of those, I can never remember which. Let's Google something and see if we get an answer!" (Okay, well, that was me not too long ago, but that's beside the point.)

In this session, we'll pull the cover back a bit on git internals and show what some of the git commands are actually doing underneath. See what comprises a blob, a tree, or a commit, and how to investigate refs. Understanding these concepts makes the commands a lot less majestic and mysterious. Knowing how the tool works makes it easier to make the right decision.

This session will be just beyond the basics of git. It should be accessible to anyone who has used git and an interesting thought exercise for those who are thinking of taking the plunge into git.

Outline

Brief history of git

  • available offline
  • distributed
  • works on existing transport and security mechanisms

Git terminology

  • repository
  • working tree
  • index
  • Objects
    • blob
    • tree
    • commit
  • remote

Git commands

Two types: porcelain and plumbing

  • porcelain: pretty, easy, what you see
  • plubming: rough, useful, foundation

Porcelain commands

  • clone
  • commit
  • fetch
  • merge
  • pull
  • reset
  • rebase
  • revert

Plumbing commands

  • hash-object
  • update-index
  • write-tree
  • commit-tree

What just happened?

  • reflog

Recovering

  • reset, revert

Crossing the streams

  • merge
  • rebase

Sharing your work

  • push
  • fetch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment