Concepts, Tips, & Tricks

https://git-scm.com/book

Git Concepts

Storing History

Other Version Control Systems

Git

Distributed/Local

The Three StaTes

The Three StaTes

Commit Tree/Graph

Three Commits

HEAD

Checkout Testing

Commit

Checkout Master

Add Tag

Commit

Another Branching Example

Three Commits

Create Feature Branch

Commit

Switch to Hotfix

Fast-Forward Master

Back to Work

Merging

Merge iss53 into master

Merge Commit

Rebasing

Integrate Experiment

Merge?

Rebase Rewrites C4

Fast-Forward Master

Tips & Tricks

Pick Up Where You Left Off

  • Use branches to separate features
  • Don't be afraid to commit (you don't have to push)

Avoid Lost Changes

  • Don't be afraid to commit
  • Anything that has been committed can be retrieved
  • If necessary, you can use a tool to recover lost commits

Keep Changes in Sync

  • Fetch (don't pull) early & often
  • Use a nice merge tool (consider SemanticMerge)
  • Turn on rerere & autostash
  • Use short-lived feature branches
  • Feel free to abort a merge/rebase and try again (make sure you turn off Gulp/Webpack/etc.)

Properly Manage Releases

  • Use a build server (e.g. TeamCity, AppVeyor, VSTS)
  • Use tags to indicate which commit a release was based on
  • Wait until the actual release to create the tag

Github Keyboard Shortcuts

  • ? — Review these shortcuts
  • T — File finder
  • Y — Canonical URL
  • L — Go to Line