You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
Version control is the foundation of CI/CD. Without a reliable system for tracking changes, collaboration, and history, no pipeline can function. This lesson covers Git fundamentals, branching strategies, and how they support continuous integration.
Version control enables:
Git is the dominant version control system used in software development. Created by Linus Torvalds in 2005, it is distributed, fast, and supports powerful branching workflows.
| Concept | Description |
|---|---|
| Repository | A project's complete history and files |
| Commit | A snapshot of changes with a message |
| Branch | A pointer to a line of development |
| Merge | Combining changes from one branch into another |
| Remote | A shared repository (e.g., on GitHub or GitLab) |
| Tag | A named reference to a specific commit (e.g., v1.0.0) |
# Clone a repository
git clone https://github.com/org/repo.git
# Create and switch to a new branch
git checkout -b feature/add-login
# Stage and commit changes
git add .
git commit -m "Add login page"
# Push changes to remote
git push origin feature/add-login
# Merge a branch
git checkout main
git merge feature/add-login
# Tag a release
git tag -a v1.2.0 -m "Release 1.2.0"
git push origin v1.2.0
Choosing the right branching strategy is critical for CI/CD success. The strategy determines how often code is integrated, how conflicts are managed, and how releases are cut.
The recommended strategy for CI/CD. All developers commit directly to the main branch (trunk) or use very short-lived feature branches (< 1 day).
gitGraph
commit
commit
branch feature
checkout feature
commit
checkout main
merge feature
commit
commit
Advantages:
When to use: Teams practising CI/CD, high-trust environments, trunk-based release cadence.
A more structured strategy with dedicated branches for features, releases, and hotfixes. Popularised by Vincent Driessen in 2010.
gitGraph
commit
branch develop
checkout develop
commit
branch feature
checkout feature
commit
checkout develop
merge feature
branch release
checkout release
commit
checkout main
merge release
checkout develop
merge release
| Branch | Purpose | Lifetime |
|---|---|---|
| main | Production-ready code | Permanent |
| develop | Integration branch | Permanent |
| feature/* | New features | Short-lived |
| release/* | Release preparation | Temporary |
| hotfix/* | Production fixes | Temporary |
Advantages:
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.