Git is a distributed open source source control (also referred to as "version control") system commonly used to track and manage file changes. Git is frequently used as the version control system for Python projects.

Official Git logo.

Git is an implementation of the source control concept. Learn how these pieces fit together in the development environments chapter or view the table of contents for all topics.

Beginner Git tutorials

Git can take awhile to wrap your head around, even for experienced software developers. The following tutorials can quickly get you up to speed.

  • The official Pro Git book is available online for free. It is awesome both as a step-by-step walkthrough and as a bookmarked reference on specific topics.

  • Git from the inside out provides a spectacular walkthrough for developers who have used Git before but want to go deeper in understanding what each command does under the covers instead of simply using the tool as a black box.

  • Think like a Git is another introduction that focuses more on the graph theory and conceptual ideas behind Git to help the reader understand what's happening as they use Git commands.

  • Git and GitHub in plain English is a high-level overview of both Git and GitHub. This guide is intended for both non-programmers and junior developers who want to learn everything from terminology to workflow.

  • A Hacker's Guide to Git is a free ebook written for experienced developers that contains both the syntax and the conceptual ideas behind how Git works.

  • A Designer's Guide to Git gives a beginner's Git overview for non-programmers. The tutorial also covers using Git clients such as the GitHub desktop application.

  • Git in Six Hundred Words is a concise essay explaining what happens when you add and commit files in a Git repository.

  • 19 Tips For Everyday Git Use is a laundry list of helpful Git tips on commands such as git bisect, git stash and git difftool.

  • git ready presents beginner, intermediate and advanced tips for how to use Git. The example commands and their results are great for learning Git piece-by-piece.

Advanced Git tutorials and resources

You won't learn Git in an afternoon or even a few months of usage. After six-plus years of working with Git I still get tripped up and have a lot to learn. These tutorials have taught me some of the beyond-the-basics edge cases.

  • Flight rules for git contains common commands that answer specific desired tasks such as "I want to discard specific unstaged files" (git checkout filename) and "I want to rename a branch" (git branch -m newname).

  • Shadows Of The Past: Analysis Of Git Repositories explains how you can extract some surprising data from Git repositories' commit history, such as which developers are domain experts in certain tools, potential hot spots in the code and coupling between source code files. This is a great read once you get past the basics of using Git.

  • Phil Nash shows how to use the git reflog command in Git back to the future.

  • On undoing, fixing, or removing commits in git is a fantastic overview of how to unscrew a whole slew of bad situations you may find yourself in if you use Git for long enough.

Specific Git resources

Large tutorials are great for getting started with Git. However, sometimes you need tactical support or want to learn new tricks to add to your workflow. These resources will come in handy for specific Git subjects.

  • How to Write a Git Commit Message provides strong advice that will help you write consistent, concise and contextual messages on your commits. Commit messages are especially important when working with others on a long-lasting project where you dive through the commit history via git log and related commands.

  • Oh shit, Git! is a profanity-filled description of tips to get you out of binds you may find yourself in when you get too tricky with Git commands.

  • Another Git catastrophe cleaned up goes through a difficult merge scenario that required deep Git understanding to properly fix.

  • Erlang's source code provides a concise explanation on writing good commit messages that any programming ecosystem can learn from.

  • GitTips is a list of pro tips to clean up common issues and how to dive through Git history to find specific text.

  • Git allows command aliasing, which allowed one developer to create his own list of lesser known Git commands that alias more complicated Git lines.

  • Little things I like to do with Git has some nice tips such as easily viewing branches you recently worked on and generating a changelog from your commits.

  • Git from the inside out demonstrates how Git's graph-based data structure produces certain behavior through example Git commands. This is a highly recommended read after you've grasped the basics and are looking to go deeper with Git.

  • How To Host Your Own Private Git Repositories provides the steps for handling private Git repositories on your own server. This setup is great for either mirroring GitHub repositories or just getting away from hosted services entirely.

  • How I configure my git in a new computer shows how to handle a .gitconfig file, with an example Gist that the author uses for his own environment.

  • How to Quickly and Correctly Generate a Git Log in HTML is an interesting look at how string processing on *nix systems works by generating an HTML page from a Git log. If you need to output your Git commits somewhere and are having trouble writing your own script you should check out some of the interesting solutions the author presents.

  • Better Git configuration explains global config options, revisions and merging along with several other commands that can be customized to your taste.

  • Why does Git use a cryptographic hash function? explains that the SHA-1 hash isn't used for security on Git, it's a consistency check. SHA-1 has been broken in practice so Git needs to transition to a stronger hash without proven collisions but it's not quite as big of a concern compared to security-related projects that use SHA-1.

  • The anatomy of a git commit digs into the tree and commit objects that underpin the Git source control system. This is an awesome read to get a view on how Git works under the commands you're using to manipulate these objects.

Git Workflows

Teams of developers can use Git in varying workflows because of Git's distributed model and lightweight branching. There is no "right way" to use Git, especially because development teams can range in size from a single developer up to entire companies with thousands of developers in a repository. The only correct answer is to let the developers decide on a workflow that maximizes their ability to frequently commit code and minimize merge conflicts.

  • git-flow shows one possible way for small teams to use Git branches. GitHub Flow explains why at GitHub they do not use the git-flow model and provides an alternative that solves some of the issues they found with git-flow.

  • Git Workflows That Work is a helpful post with diagrams to show how teams can create a Git workflow that will help their development process.

  • "Our Git Workflow" by Braintree goes over how this payments company uses Git for development and merging source code.

What else do you want to learn about?

I've built a Python web app, now how do I deploy it?

I want to learn more about app users via web analytics.

How do I log errors that occur in my application?

Sign up for two emails per month with Python tutorials and Full Stack Python updates.

Full Stack Python

Full Stack Python is an open book that explains concepts in plain language and provides helpful resources for those topics.
Updates via newsletter, Twitter & Facebook.
1. IntroductionLearning ProgrammingWhy Use Python?Python 2 or 3?Enterprise PythonPython CommunityCompanies using PythonBest Python ResourcesBest Python VideosBest Python Podcasts2. Development EnvironmentsText Editors & IDEsVimEmacsSublime TextPyCharmJupyter NotebookBash shellShellsZshPowerShellTerminal MultiplexerstmuxScreenPymuxEnvironment configurationApplication DependenciesSource ControlGitMercurialApache SubversionHosted Source ControlGitHubBitBucketGitLab3. Core LanguageGeneratorsComprehensions4. TestingUnit TestingIntegration TestingCode MetricsDebuggingLoggingMarkdown6. Security7. Web DevelopmentWeb FrameworksDjangoFlaskBottlePyramidFalconMorepathSanicOther Web FrameworksTemplate EnginesJinja2MakoDjango TemplatesWeb DesignHTMLCascading Style Sheets (CSS)Responsive DesignMinificationCSS FrameworksBootstrapJavaScriptTask QueuesCeleryRedis Queue (RQ)DramatiqStatic Site GeneratorsPelicanLektorMkDocsWebSocketsuvloop8. DeploymentServersStatic ContentPlatform-as-a-ServiceVirtual Private ServersOperating SystemsUbuntuWeb ServersApache HTTP ServerNginxCaddyWSGI ServersGreen Unicorn (Gunicorn)Continuous IntegrationJenkinsConfiguration ManagementAnsibleDockerServerlessAWS LambdaGoogle Cloud Functions9. DataRelational DatabasesPostgreSQLMySQLSQLiteObject-relational MappersSQLAlchemyPeeweeDjango ORMSQLObjectPony ORMNoSQL Data StoresRedisMongoDBApache CassandraNeo4jData analysispandasBokehd3.jsMatplotlib10. Web APIsMicroservicesBotsAPI CreationAPI IntegrationTwilio11. DevOpsMonitoringCachingRollbarWeb Analytics12. Change LogWhat Full Stack MeansAbout the AuthorFuture DirectionsPage Statuses ...or view all topics.

Matt Makai 2012-2018