Git tutorial
Preface
The aim of this tutorial is to give a thorough and technical introduction to Git, accompanied by a lot of examples and exercises. Hopefully, this will not only teach you how to use basic Git commands, but also help you understand how Git works, at least on a superficial level, so that you do not end up in the situation depicted in the webcomic.
The tutorial is structured in two parts. Part I starts with an introduction to version control in general, followed with an introduction to what Git is and how it works. Next, Part I focuses on introducing all the basic Git commands and how to use them. Part II includes stand-alone chapters on more advanced topics. These chapters are not essential to learning how to use Git, and can be read to the extent they are relevant and of interest. Finally, the tutorial includes appendices on miscellaneous topics.

Webcomic title text:
“If that doesn’t fix it, git.txt contains the phone number of a friend of mine who understands git. Just wait through a few minutes of ‘It’s really pretty simple, just think of branches as…’ and eventually you’ll learn the commands that will fix everything.”
Prerequisites
The only prerequisites for this tutorial is that you are on a Windows machine and have “Git for Windows” installed. See Appendix A — Git for Windows for more details. It is of course also possible to follow the tutorial if you are on a macOS or Linux system, or if you prefer to use PowerShell or Command Prompt on Windows. Since we will be running Git from the command line using Git BASH, a BASH emulator, macOS and Linux users should only run into a few minor issues where modifications are necessary. PowerShell and Command Prompt users will have to find alternatives to all non-Git commands, although these are not essential for the tutorial and can be done manually instead if necessary.
The tutorial assumes you are using Git version 2.51.0 or newer. If you are using an older version of Git, some of the git config commands in Appendix C — Configuration of Git might not work, and there might be other minor unknown issues as well.