Introduction to Drupal Git
Introduction
Most projects within the larger Drupal open-source software project and community have an associated source code repository, which is managed using the Git revision control system and GitLab software. This page describes how the Drupal project uses Git. Background information you will need:
- Overview of Drupal projects and issues
- Wikipedia article on version control
- Wikipedia article on diff -- "patch" files, mentioned in many of the pages in the Git section, are in unified diff format.
- Pro Git book -- Read chapter 1 and section 2.1 for necessary background knowledge for understanding this page
- Git documentation home page -- links to videos that provide similar background knowledge, reference pages, and other documentation
- GitLab user documentation
The Additional Resources section at the bottom of this page has links to more documentation.
Project Git repositories
Each individual project within the larger Drupal project has its own, separate Git repository, with its own branches and tags. From each project home page, such as the Admin Toolbar contributed module project page, there are two links related to Git:
The Version control tab (near the top of the page) links to a page that provides a command that anyone can use to clone the project's Git repository, and other helpful Git commands that are mostly used by project maintainers.
The Browse code repository link in the sidebar links to a GitLab page where you can view source code, see the commits that revised the source code, and propose edits to the source code for the project. (The View commits link in the project sidebar page also shows a list of the recent commits.) You can also go directly to the GitLab page for a given project by visiting https://git.drupalcode.org/project/PROJECT_SHORTNAME
, where PROJECT_SHORTNAME is the short name for the project (URL suffix of the project page).
Branches, tags, and releases
Project maintainers can create branches in the source code repository, corresponding to major and/or minor versions of the software. For versions compatible with Drupal core 8.8.x and later, projects are encouraged to use semantic versioning; for example, a project might have a 1.0.x branch. For versions compatible with older Drupal core software, the branch might be 7.x-1.x or 8.x-1.x.
Within each branch, project maintainers can create tags for individual software releases. Tags might be named 1.0.0 or 8.x-1.0, depending on the branch scheme being used. See the Git for Project Managers guide guide for more information.
Additional Resources
Here are some tools you might consider downloading:
- drupalorg-cli: A command-line tool that is very useful for dealing with Git, patches, drupal.org issues, and releases
Here are some additional resources for learning more about Git (in addition to links in sections above):
- GitHub Learning Lab -- online courses for learning Git on GitHub (which is similar but not quite the same as the GitLab software we use to manage Git)
- Understanding Git Conceptually - A very well written guide on the fundamentals of Git. It is nigh impossible to understand git without this guide.
- Git Ready - Great tutorial material that is very accessible.
- "Change Management and Version Control" video series from Build a Module.com - Thorough video tutorials of using Git to manage a Drupal workflow.
- Git podcasts list
- Git Immersion - Accessible tutorials
- Git Magic [GitHub repo] - An excellent, short tutorial on using Git, covering both basic and more advanced commands in a simple and useful way.
- Definitive practical guide - A fairly comprehensive outline of links on Stackoverflow.com.
- List of documentation resources at kernel.org wiki
- A successful branching model. Good reference dealing with branching and merging branches.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion