Git is a widely used distributed version control system. On this page, I collected different resources, from how to learn Git as a beginner, to mastering advanced use cases. Enjoy!
Content
Git at first sight
Cheat Sheets
Cheat sheets are a great way to keep an overview over all the different commands and what they do. Many cheat sheets exist, so I will highlight the ones I found most interesting.
Two rather unconventional ones:
- Interactive Cheat Sheet (Webapp)
- Escape a git mess, step-by-step, curtesy of justin hileman
And two conventional ones:
- Github Education Cheat Sheet
- Git Cheat Sheet listing the most important basic commands
Quicklinks
- Interatively visualizing commits and branches, including merging, rebasing, and simulating a remote repository: learngitbranching.js.org
Interesting reads
- The (written) unwritten guide to pull requests
- Blog-Series about more advanced topics about the usage and the environment of git.
- So you think you know Git? – a fun talk about more obscure features of Git
Learning Git
The Git Parable
The Git Parable should be read or listened to by everyone, in my opinion. It's a great way to learn Git by understanding why it was designed the way it is today. Here, a short quote from the first section of the parable:
The following parable will take you on a journey through the creation of a Git-like system from the ground up. Understanding the concepts presented here will be the most valuable thing you can do to prepare yourself to harness the full power of Git. The concepts themselves are quite simple, but allow for an amazing wealth of functionality to spring into existence.
- Original text by Tom Preston-Werner: https://tom.preston-werner.com/2009/05/19/the-git-parable.html Only text, no visuals.
- Live talk by Johan Herland: https://www.youtube.com/watch?v=jm7QsI-nNjk&ab_channel=NDCConferences 90 Minutes. Same story, but enhanced with slides and visuals.
- Slides from the talk: https://github.com/jherland/git_parable/blob/master/git_parable.pdf
- Shorter video with text-to-speech audio of the original text and the slides of Johan Herland: https://www.youtube.com/watch?v=GyHdoGZY69E&ab_channel=JayneTheGrateful
Basics
- Extensive Guide by Atlassian about many git commands (what they do, how to use them, and how they work): https://www.atlassian.com/git/tutorials/setting-up-a-repository
- Git for the lazy: https://wiki.spheredev.org/index.php/Git_for_the_lazy A very quick and shallow guide on how to get started with git.
- Talk “Introduction to Git” by Scott Chacon: https://www.youtube.com/watch?v=ZDR433b0HJY&ab_channel=InfoQ This talk seems to cover the basics on how to get started, but also with a few internals mixed in.
Learning (Git) by Doing
- Hands-on step-by-step guide from the basics to advanced stuff: https://gitimmersion.com/index.html This guide is creating a small project in the ruby programming language, but it seems like you don't need to know ruby in order to follow the guide.
- Program for a playful introduction to the most important git commands: https://ohmygit.org/
- Website for learning branching and modifying history in git: https://learngitbranching.js.org/ This tutorial only teaches some parts of git! Some parts are not covered at all, but the other parts are covered beyond the basics.
Intermediate
- Visual Git Reference: http://marklodato.github.io/visual-git-guide/index-en.html Visualizations about how common git commands work.
Advanced
- Git Internals PDF: https://raw.githubusercontent.com/pluralsight/git-internals-pdf/master/drafts/peepcode-git.pdf A document explaining the internals of git (but also giving an introduction for beginners)
- Think Like (a) Git: http://think-like-a-git.net/ Guide for people that know how to use git, but want to learn something about the internals of git.
- Advanced Git topics by Atlassian: https://www.atlassian.com/git/tutorials/advanced-overview
Specific git config per directory
In your directory, where you want to have a different git config (e.g. name and email), create a .gitconfig. For example like this:
[user]
user = Max Mustermann
email = my_email@gmail.com
In your .gitconfig in your user/home directory, add the following:
[includeIf "gitdir:~/path/to/directory"]
path = "~/path/to/directory/.gitconfig"
Specific commands
The following is a list of some commands that are not part of the absolute basics, but worth knowing.
-
git stash: https://www.atlassian.com/git/tutorials/saving-changes/git-stash -
git revert: https://www.atlassian.com/git/tutorials/undoing-changes/git-revert -
git bisect: https://git-scm.com/docs/git-bisect -
git cherry-pick: https://www.atlassian.com/git/tutorials/cherry-pick -
git reflog: https://www.atlassian.com/git/tutorials/rewriting-history/git-reflog -
git commit --amend: https://www.atlassian.com/git/tutorials/rewriting-history -
git reset: https://www.atlassian.com/git/tutorials/undoing-changes/git-reset -
git rebase (-i): https://www.atlassian.com/git/tutorials/rewriting-history/git-rebase git config credential.helper store