A hands-on, practical lab environment for mastering Git version control, branching strategies, conflict resolution, Pull Request workflows, and Conventional Commits for DevOps engineers.
Overview • Branching Architecture • Hands-On Exercises • Conventional Commits • Cheatsheet
Version control is the backbone of all modern DevOps and Continuous Integration/Continuous Deployment (CI/CD) practices. This repository serves as a sandbox environment where engineers can practice feature branching, remote collaboration, merge conflict resolution, and trunk-based continuous delivery without risking production code.
gitGraph
commit id: "Initial Commit"
commit id: "Base Scaffold"
branch feature/user-auth
checkout feature/user-auth
commit id: "feat: add JWT auth middleware"
commit id: "test: verify token validation"
checkout main
commit id: "docs: update API documentation"
checkout feature/user-auth
commit id: "fix: handle expired tokens"
checkout main
merge feature/user-auth tag: "PR #1 Merged"
branch bugfix/db-timeout
checkout bugfix/db-timeout
commit id: "fix: adjust connection pool timeout"
checkout main
merge bugfix/db-timeout tag: "v1.0.0 Release"
-
Clone the repository:
git clone https://github.com/codewithmuh/devops-training.git cd devops-training -
Create a dedicated feature branch:
git switch -c feature/add-healthcheck
-
Implement your changes and stage:
echo "GET /healthz 200 OK" >> healthcheck.txt git add healthcheck.txt
-
Commit using Conventional Commits:
git commit -m "feat(api): implement standard healthcheck endpoint" -
Push upstream and open a Pull Request:
git push -u origin feature/add-healthcheck
-
Modify a common line on your branch:
echo "DevOps Training Lab Update - Branch A" > Notes.txt git commit -am "chore: update notes from branch A"
-
Simulate a conflicting commit on
main:git checkout main echo "DevOps Training Lab Update - Branch Main" > Notes.txt git commit -am "chore: update notes from main"
-
Attempt to merge:
git merge feature/add-healthcheck # CONFLICT (content): Merge conflict in Notes.txt -
Resolve the conflict: Open
Notes.txt, choose the correct lines between<<<<<<< HEAD,=======, and>>>>>>>, save the file, and finalize:git add Notes.txt git commit -m "fix(merge): resolve conflicting notes updates"
Standardized commit messages ensure automated changelogs and clean repository history:
| Prefix | Description | Example |
|---|---|---|
feat: |
Introduces a new feature or capability | feat(auth): add OAuth2 Google login provider |
fix: |
Patches a bug or defect | fix(cors): permit localhost origins in development |
docs: |
Updates documentation or README files | docs(readme): add architecture flowchart and setup guide |
chore: |
Maintenance tasks, dependency updates | chore(deps): bump actions/checkout to v4 |
ci: |
CI/CD pipeline modifications | ci(github): add automated trivy security scan job |
refactor: |
Code refactoring without changing functionality | refactor(db): migrate connection logic to singleton |
Inspect commands.txt for an exhaustive list of essential daily Git commands covering branching, stashing, log visualization, and reset mechanics.
- Full DevOps Training Hub: devops-training-resources
- LinkedIn Community: Follow Muhammad Rashid
- YouTube Tutorials: CodeWithMuh Channel
This project is licensed under the MIT License.