merge mastering version control for modern delivery

Git + DevOps —
collaborate · automate · deliver

Version control is the backbone of DevOps. Git powers collaboration, enables CI/CD pipelines, and provides the audit trail that modern software teams rely on to ship with confidence.

code Git
sync_alt
DevOps rocket

Git fundamentals

Git is a distributed version control system that tracks changes in source code during software development. Unlike centralized systems, every developer has a full copy of the entire repository history.

Git operates across three primary states: the Working Directory (where you edit files), the Staging Area (where changes are prepared for commit), and the Local Repository (the .git directory that stores all commits).

Every file and commit is identified by a cryptographic SHA-1 hash, ensuring complete data integrity — it's impossible to change any file or commit without Git detecting it.

~/git-fundamentals
$ git init
Initialized empty Git repository in /project/.git
$ git add .
$ git commit -m "first commit"
[main (root-commit) a1b2c3d] first commit
$ git log --oneline
a1b2c3d first commit
 
$ git status
On branch main
nothing to commit, working tree clean

Branching strategies

Branching enables parallel development. Different strategies suit different teams — from structured release cycles to continuous deployment.

account_tree Git Flow

Structured model with strict branch roles — ideal for scheduled releases.

  • main main — production-ready code
  • developer_mode develop — integration branch
  • feature feature/* — new features
  • release release/* — release preparation
  • build hotfix/* — critical production patches

all_inclusive GitHub Flow / Trunk-Based

Lightweight, streamlined — perfect for continuous delivery and SaaS.

  • main main — single source of truth
  • feature short-lived branches — direct from main
  • merge frequent merges — multiple times per day
  • rocket continuous deployment — automated pipelines

Pull requests & code reviews

merge Pull requests

A PR is the social and technical contract of modern engineering — signaling that code is ready for integration.

  • chat Centralized discussion — inline comments on code
  • play_arrow Automated triggers — CI runs tests on every PR
  • history Audit trail — immutable record of decisions

rate_review Code reviews

Peer review is a primary driver of quality and team alignment — not a bureaucratic bottleneck.

  • crop_square Keep PRs small — under 300 lines
  • precision_manufacturing Automate style — linters handle formatting
  • architecture Focus on logic — scalability, security, edge cases
  • handshake Blameless tone — mentor, not dictate

Merge conflicts

When two developers modify the same line of code on different branches, Git halts with a merge conflict. Conflicts are a normal, healthy sign of parallel development.

<<<<<<< HEAD (your current state)
const timeout = 5000;
=======
const timeout = 10000;
>>>>>>> feature/extend-timeout
  • sync Communicate early — pull from main daily
  • visualization Use visual tools — VS Code, GitKraken
  • checklist Test post-resolution — run your suite

tips_and_updates Best practices

  • check_circle Resolve conflicts in the IDE
  • check_circle Understand both changes before resolving
  • check_circle Communicate with the other developer
  • check_circle Run tests after every conflict resolution

Git workflows

feature

Feature branch workflow

Every new feature lives on its own branch. Isolates experimental work from stable codebase. Merged back to main via PR.

fork_left

Forking workflow

Common in open-source. Contributors fork the repo, push to their fork, and open PRs to the upstream repository.

all_inclusive

Trunk-based development

Developers merge to main frequently — often multiple times per day. Enables true continuous delivery.

Git in CI/CD pipelines

Git drives the entire delivery lifecycle. Webhooks trigger pipelines on every push, PR, or tag — turning version control events into automated workflows.

PUSH webhook trigger BUILD compile TEST suite PACKAGE artifact DEPLOY prod GITOPS reconcile continuous reconciliation
CI — push, build, test
CD — package, deploy
GitOps — reconcile

GitOps: The ultimate convergence

GitOps applies DevOps best practices to infrastructure management. The entire desired state of infrastructure is stored in Git.

  • cloud Declarative infrastructure — Kubernetes, Terraform manifests in Git
  • sync Automated reconciliation — agents (Argo CD, Flux) sync live state to Git
  • undo Rollback = git revert — complete auditability and recovery

check_circle GitOps benefits

  • check Single source of truth
  • check Complete audit trail
  • check Self-healing infrastructure
  • check Faster recovery

References & further reading

article
Atlassian — Git Tutorial: Learn Git branching, workflows, and best practices
article
GitHub — Understanding the GitHub Flow and CI/CD Automation
article
GitLab — DevOps Lifecycle with Git, CI/CD, and GitOps
article
Pro Git Book — Git Internals and Distributed Version Control