Fork me on GitHub

Source control

Source control systems, also known as version control systems, store code and other static files, such as images, with a history of the changes made to those files.

Why is source control necessary?

Version control systems allow developers to modify code without worrying about permanently screwing something up. Unwanted changes can be easily rolled back. Developers can merge changes with other developer's code through diff views.

These benefits exist on all software projects. Therefore version control is a necessity regardless of time size or the programming ecosystem used. Every project should immediately begin by using a version control system such as Git or Mercurial.

App deployment uses a server to pull from the source control system.

Pulling code during a deployment is a potential way source control systems fit into the deployment process.

Note that some developers recommend deployment pipelines package the source code to deploy it and never have a production environment touch a source control system directly. However, for small scale deployments it's often easiest to pull from source code when you're getting started instead of figuring out how to wrap the Python code in a system installation package.

Source control systems

  • Git is a free and open source distributed version control system.

  • Mercurial is similar to Git, also a free and open source distributed version control system.

Source control hosted services

  • GitHub is currently the most commonly used source control platform for using Git.

  • BitBucket provides free Git and Mercurial repositories for open projects and private repositories for up to five users. Users pay for hosting private repositories with more than five users.

Source control resources

Git resources

  • Pro Git is a free open source book that walks through all aspects of using the version control system.

  • A Hacker's Guide to Git covers the basics as well as more advanced Git commands while explaining each step along the way.

  • git ready has a nice collection of blog posts based on beginner, intermediate and advanced Git use cases.

  • git-flow details a Git branching model for small teams.

  • GitHub Flow builds on git-flow, goes over some of the issues that arise with it and presents a few solutions to those problems.

  • 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.

Source control learning checklist

Pick a version control system. Git is recommended because on the web there are a significant number of tutorials to help both new and advanced users.

Learn basic use cases for version control such as committing changes, rolling back to earlier file versions and searching for when lines of code were modified during development history.

Ensure your source code is backed up in a central repository. A central repository is critical not only if your local development version is corrupted but also for the deployment process.

Integrate source control into your deployment process in three ways. First, pull the project source code from version control during deployments. Second, kick off deployments when code is modified by using webhooks or polling on the repository. Third, ensure you can roll back to a previous version if a code deployment goes wrong.

Now that your source code is versioned, what's next?

How do I deploy the code I've created for my web app?

I want to learn more about the users of my application.

How do I integrate external APIs into my web application?


对Full Stack Python这本书很感兴趣?想要一本包含代码、详细教程的完整版吗?那么用邮箱订阅吧。一旦完成了我就会发给你的,别担心除了订阅确认邮件,我是不会给你发乱七八糟的邮件的。