What you will learn in this TP
- Work with short branches
- Automate a rule with a hook
- Version and undo
Introduction #
What you will learn in this section
- Work with short branches
- Automate a rule with a hook
- Version and undo
Context. Your team merges long branches once a month and spends days solving conflicts. You set up a tooled trunk-based workflow.
Prerequisites: Git 2.30 or later · Estimated time: 35 min
A repository with a readable history, two published versions and a rollback.Hands-on #
Guided steps, with their solution.
1. Create the repository
Why? main is the only long-lived branch: it must always be releasable.
Initialise a repository with a small application and a first commit onmain.2. Enforce conventional commits
Why? An automatically checked rule no longer depends on everyone's memory.
Write acommit-msghook rejecting messages that do not followtype(scope): description, then test it.3. A short branch and its merge
Why? A branch lasting a few hours merges without conflict and is easy to review.
Createfeat/remise, add a discount function in two small commits, update the branch withrebasethen merge it (squash) into main.4. Publish versions
Why? Semantic versioning tells users what they risk when upgrading.
Tagv1.0.0, add a conventional fix, deduce the next number, tag it and generate the list of changes between the two versions.5. Undo without rewriting history
Why? On a shared branch, you undo with a new commit: nobody loses their work.
Introduce a faulty commit, find it withgit bisectand undo it withgit revert.
Difficulty level : ●●○○○ (2/5)
My progress
Sign in to track your progress and take notes. Sign in
💬 Questions about this lesson
No questions yet: be the first to ask for help or share your configuration.
Recommended Articles
Git for DevOps: branches, code reviews and versions
Organize work with Git in a DevOps approach: trunk-based development or GitFlow, short-lived bran...
DevOps best practices: culture, CI/CD, infrastructure as code and measurement
DevOps best practices: culture and collaboration, continuous integration and delivery, trunk-base...
The wall of confusion
The 'wall of confusion' is a metaphor often used in a DevOps context to describe the cultural, or...
Platform engineering, FinOps and AI: the new frontiers of DevOps
Understand how DevOps is evolving: platform engineering and internal developer platforms (IDP), g...
Measuring DevOps performance: DORA metrics, SPACE and continuous improvement
Measure and improve delivery performance: the DORA metrics (deployment frequency, lead time, chan...
The Twelve-Factor App
A detailed guide to the twelve-factor methodology for building modern, scalable applications in c...
Git Sync in Grafana: version dashboards in GitHub
Sync Grafana dashboards and folders with a GitHub repository: prerequisites, token, setup in Admi...
End-to-end CI/CD (1/5): principles and anatomy of a pipeline
Understand end-to-end CI/CD: continuous integration, continuous delivery and continuous deploymen...
End-to-end CI/CD (2/5): continuous integration, testing and quality
Succeed with continuous integration: the test pyramid, unit, integration, contract and end-to-end...