List of resources that will give you a good understanding of how to use Git.
Everything you need to get started.
- learngitbranching.js.org: Interactive Git lessons teaching you the basics.
- Visualizing Git Concepts resp. visualizing Git commands.
Have a look at the example visualizations and try them out yourself—it’s fun.
- The Pro Git Book’s first three chapters. The remaining chapters go beyond the absolute basics and will be useful later on.
- Git SCM Docs: Command reference manual, cheat sheets, “Pro Git book”, videos.
- Git SCM external links: Curated, ever-evolving collection of tutorials, books, videos, and other Git resources.
- Git SCM Wiki
- The simple guide
- The Git parable: Mental creation of a Git-like system from the ground up. Explains the function of each part and how they complement each other.
- Git pretty: Workflow chart
- Making Sense of Git: Visual explanation of core Git concepts
- A Visual Git Reference: Once you know a bit about how git works, this site may solidify your understanding.
- Git concepts simplified
- Git from the bottom up
- Think Like (a) Git: A guide for the perplexed.
- Practical Git introduction
Tips and FAQ
- Git tips: Common questions and their solutions
- GitHub Cheat Sheet: Tips for working with GitHub
- Oh, shit, git!: How to get out of difficult situations
- Git Flight Rules Detailed “if x then y”
- GitHub’s Git Handbook
- Git Exercise Learn and practice (source)
- Learn Git Branching (source)
Now some example visualizations of simple Git command combos using D3.
Apart from using them to give yourself a better understanding of how Git is manipulating the commit graph, they are great to visualize what Git does while explaining somebody how to use Git. This is much better than drawing something on paper because you can take a screenshot and they can play around with it afterwards.
Note: It is difficult to understand the final graphs and much easier, if you type in the commands yourself and see how the graph changes with each command.
pull resulting in a merge commit
git push on the website to get the initial setup.
This is an example of how a
pull will result in a merge commit, if the
remote branches each have commits that are not part of the other.
pull --rebase resulting in linear history
git pull on the website to get the initial setup.
In this scenario you based your work on the remote branch
origin/master and commited your changes to your local branch
master. In the meantime, at least one commit was pushed to
origin/master (by somebody else). Now you cannot simply push your local commits from
origin/master, because the commit history of
origin/master is no longer a subset of
The easiest way to deal with this, is to rebase your local changes on top of the new changes that were introduced to
orign/master. This is done via
git pull --rebase respectively
git pull --rebase origin master. After you resolved any merge conflicts,
origin/master is now again a subset of your
master allowing you to push your new commits to
Hint: In practice you can perform an interactive rebase via
git pull --rebase=interactive to see which commits will be applied. This gives you the opportunity to review what will be done and cancel/modify it, if necessary.
git fetchfollowed by
git pull --rebase:
git fetchfollowed by