DEV Community

Bhaskar Sharma
Bhaskar Sharma

Posted on

๐Ÿš€ Day 3 of My DevOps Journey: Git & GitHub for DevOps (From Zero to Daily Workflow)

Hello dev.to community! ๐Ÿ‘‹

Yesterday we explored Linux as the foundation. Today weโ€™re layering the next essential skill: Git & GitHub โ€” the backbone of collaboration, CI/CD, and reliable releases.

๐Ÿ”น Why Git matters for DevOps

Traceability: every change is tracked with author, time, and reason.

Safe collaboration: branches, pull requests, and reviews prevent โ€œit works on my machineโ€ disasters.

Automation-ready: GitHub is often the source of truth that triggers CI/CD, security scans, and deployments.

๐Ÿง  Core concepts (quick glossary)

Repo: the project database of your code history.

Commit: a snapshot + message of what changed and why.

Branch: an isolated line of work (e.g., feature/login).

PR (Pull Request): propose, review, and merge changes.

Tag/Release: freeze a version (e.g., v1.2.0) for deploys.

๐Ÿ› ๏ธ Commands Iโ€™m mastering (cheat-sheet)

set identity (do once)

git config --global user.name "Your Name"
git config --global user.email "you@example.com"

start & inspect

git init
git clone
git status
git log --oneline --graph --decorate

stage & commit

git add .
git commit -m "feat: add healthcheck endpoint"

branching

git branch -M main
git switch -c feature/healthcheck # or: git checkout -b feature/healthcheck
git merge main

undo safely

git restore # discard unstaged changes
git revert # make a new commit that undoes another

share

git remote add origin
git push -u origin main
git push -u origin feature/healthcheck
**

๐ŸŒฟ Branching that suits DevOps

Trunk-Based Development (recommended for most teams):
Short-lived branches โ†’ small PRs โ†’ merge to main multiple times a day.

Release tags: v1.0.0, v1.0.1 for deploys and rollbacks.

Protection rules: require PR reviews, statuses (tests) to pass before merging.

๐Ÿค GitHub features youโ€™ll use daily

Pull Requests: code review, inline comments, required approvals.

CODEOWNERS: auto-request the right reviewers.

Branch protection: block force-pushes & direct commits to main.

Issues & Projects: track work; link commits/PRs to issues.

Actions (CI): run tests, linters, builds on each push/PR.

๐Ÿงช Hands-on mini-labs (do these!)

Start a repo: README.md, .gitignore, LICENSE โ†’ initial commit โ†’ push.

Feature flow: create feature/* branch โ†’ change code โ†’ open PR โ†’ request review โ†’ squash merge.

Conflict drill: create a conflict on purpose and resolve it via PR.

Tag & Release:

git tag -a v0.1.0 -m "first cut"
git push origin v0.1.0

Create a GitHub โ€œReleaseโ€ from the tag.

Protect main: require 1 review + status checks before merge.

โš™๏ธ Bonus: a tiny GitHub Actions pipeline (runs tests on PRs)

Create .github/workflows/ci.yml:

name: ci
on:
pull_request:
branches: [main]
push:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: npm ci
- run: npm test

Swap Node for Python/Go/etc. as needed. This single file gives you instant feedback on every PR.

๐Ÿงญ Good habits from day one

Write meaningful commit messages (use prefixes like feat:, fix:, docs:).

Keep PRs small & focused (easier reviews, faster merges).

Never commit secrets โ€” use .gitignore and secret managers.

Tag releases that are deployed; link PRs to issues for traceability.

๐ŸŽฏ Key takeaway

Before Docker, K8s, or fancy pipelines โ€” get comfortable with Git & GitHub. Clean history + protected main + automated checks = fewer outages and faster delivery.

๐Ÿ”œ Tomorrow (Day 4)

Iโ€™ll cover Bash scripting for DevOps โ€” turning repetitive terminal steps into reliable automation.

DevOps #Git #GitHub #VersionControl #SourceControl #CICD #Automation #Collaboration #SoftwareEngineering #CloudNative #ContinuousIntegration #ContinuousDelivery #OpenSource #DevOpsEngineer #CodingBestPractices #DeveloperTools #SRE

Top comments (0)