A Visual Git Reference

This page gives brief, visual reference for the most common commands in git. Once you know a bit about how git works, this site may solidify your understanding. If you're interested in how this site was created, see my GitHub repository.

Also recommended: Visualizing Git Concepts with D3

Contents

  1. Basic Usage
  2. Conventions
  3. Commands in Detail
    1. Diff
    2. Commit
    3. Checkout
    4. Committing with a Detached HEAD
    5. Reset
    6. Merge
    7. Cherry Pick
    8. Rebase
  4. Technical Notes
  5. Walkthrough: Watching the effect of commands

Basic Usage

The four commands above copy files between the working directory, the stage (also called the index), and the history (in the form of commits).

You can use git reset -p, git checkout -p, or git add -p instead of (or in addition to) specifying particular files to interactively choose which hunks copy.

It is also possible to jump over the stage and check out files directly from the history or commit files without staging first.