Greg Lund-Chaix, Senior Infrastructure Engineer at Tag1, hosted a webinar for Drupal 4 Gov to teach users how to simplify their development workflows by using local development environments. His talk shows you some common tools, his four rules for development, and some basic techniques to help you use Git effectively to improve your processes and enhance your approach to development.
In his talk, Greg discusses the following tools and what makes them useful to you:
- DDEV: https://www.ddev.com
- Lando: https://lando.dev
He also walks you through the installation of DDEV, to help you understand how easy it can be to set up a local development environment. These tools assist with automated environment creation and more, with included developer tools (MySQL, Composer, Drush, and so on) to make it easy for you to get to work. Tools like DDEV and Lando ensure your local environment matches your production environment, preventing long troubleshooting sessions when something works locally, but not on production.
The four rules
Next, Greg talks about his four rules for development, and why they save time:
- Work in a branch.
- Don’t merge your own code.
- Never edit on the server(s).
- Your ‘main’ branch is always deployable.
These four rules ensure you make fewer mistakes that could introduce bugs, or even cause outages due to bad code. Branches ensure you’re not editing on the server, and that your code changes are contained. Requiring others to review your code before a merge helps ensure fewer mistakes make it through, and help you become a better developer. These help keep your ‘main’ branch deployable at all times, so you’ve always got a working code base.
Git basics
Finally, Greg shows off some basic Git techniques. Many of these are common to experienced developers, but not as well known by others. They will help you develop more quickly, with fewer mistakes.
- Rebase often.
- Set up a helpful git-prompt.
- Used narrowly focused branches.
- Push & pull regularly to avoid merge conflicts.
- Learn the differences between git merge and git pull --rebase including never merging your own code.
- Sniff and lint your code before committing.
Each of these practices ensure that fewer mistakes ever make it to the ‘main’ branch. Understanding merging and rebasing, and when to use them ensures your team never overwrites each other’s work. Focused branches ensure it’s clear why and where you made changes. Regular pushes and pulls keep your entire team’s branches up to date.
About Drupal 4 Gov
Drupal 4 Gov is an open source community for developers and IT professionals with an interest in making the government more open to open source. This blog was based on Greg’s Drupal 4 Gov presentation.
It encompasses many open source projects but their beginnings are in the Drupal project.
Drupal 4 Gov offers:
- Drupal GovCon - held September 24th - 25th 2020 - virtually
- Gov Summit @ DrupalCon
- Global Training Days/Half Training Days
Tag1 Consulting thanks Drupal 4 Gov for its permission to reshare this presentation.
Photo by sergio souza on Unsplash