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
End-to-end CI/CD (3/5): artifacts, registries and environments
Deliver continuously: immutable, versioned artifacts, image and package registries, promoting the...
End-to-end CI/CD (4/5): deployment strategies and rollback
Deploy without downtime and without risk: recreate, rolling update, blue/green, canary, feature f...
End-to-end CI/CD (5/5): GitHub Actions, GitLab CI, Jenkins and Argo CD in practice
Compare and use CI/CD tools: GitHub Actions, GitLab CI, Jenkins, Argo CD and Flux; a complete pip...
Infrastructure as Code and GitOps: Terraform, Ansible and Argo CD
Manage infrastructure as code: declarative or imperative, Terraform (providers, state, plan, modu...
DevSecOps: securing the software supply chain end to end
Integrate security into the DevOps pipeline: shift-left, threat modeling, secret detection, SAST,...
Observability, SRE and incident management for DevOps teams
Operate what you ship: metrics, logs and traces, golden signals, SLIs, SLOs and error budgets, ac...
The CALMS framework: the 5 pillars of DevOps
Discover the CALMS framework, the essential foundation for a successful DevOps transformation, th...
Bindplane configurations: sources, processors, destinations and versions
Build Bindplane configurations: sources, processors and destinations, the pipeline editor, snapsh...
Release monitoring in Dynatrace: versions, deployment events and issue tracking
Track deployed versions in Dynatrace: DT_RELEASE variables, Kubernetes labels, deployment events ...