Today I didn’t just “practice Git.”
I understood how code actually travels from my laptop to production.
If you’re a fresher or junior developer, this mental model will change everything.
1. Git Is Graph Theory, Not File Tracking
Git is a Distributed Version Control System, but internally it’s:
A Directed Acyclic Graph (DAG) of commits.
Each commit:
- Is immutable
- Has a parent pointer
- Stores a snapshot (tree)
- Has a hash generated from metadata
A branch?
Just a movable pointer.
Once you understand that, push rejections and rebases stop feeling random.
🧠 Merge vs Rebase (Visually)
🔹 Merge
- Preserves original commits
- Creates a merge commit
- Safe for shared branches
- Non-linear history
🔹 Rebase
- Replays commits on new base
- Creates new commit hashes
- Linear history
- Dangerous if already pushed
Big realization:
Rebase rewrites history because parent pointers change → new hash generated.
That’s structural. Not magic.
2️⃣ Why Push Gets Rejected (Fast-Forward Concept)
Fast-forward push works when:
Remote branch is ancestor of your local branch.
Git just moves the pointer forward.
If histories diverge?
Push rejected.
Safer fix:
git push --force-with-lease
Always think in terms of commit ancestry, not “who committed last”.
3️⃣ Practical Git Workflow (Industry Style)
Here’s a real feature branch sequence:
🧩 Create Feature Branch
git checkout main
git pull origin main
git checkout -b feature/login-api
✍️ Work & Commit
git add .
git commit -m "Add login controller"
🔄 Sync With Main (Clean Way — Rebase)
git fetch origin
git rebase origin/main
If conflict:
# fix manually
git add .
git rebase --continue
After rebase:
git push --force-with-lease
🔀 Alternative (Merge Instead of Rebase)
git fetch origin
git merge origin/main
git push
No history rewrite. Adds merge commit.
🧠 Minimum Git Command Set Every Fresher Must Know
git branch
git checkout -b <branch>
git add .
git commit -m "message"
git fetch
git merge
git rebase
git push
git push --force-with-lease
git pull --rebase
git log --oneline --graph
If you understand:
- When to rebase
- Why push is rejected
- What fast-forward means
You’re already ahead of most beginners.
4️⃣ What Happens After You Push? (CI/CD Reality)
Your job doesn’t end at git push.
Push triggers a pipeline.
Push → Pipeline → Jobs → Runner → Artifacts
⚙️ GitLab CI Architecture
Key components:
.gitlab-ci.yml- Pipeline
- Stages
- Jobs
- Runner
- Artifacts
Important:
- Stages run sequentially
- Jobs in a stage run parallel
- If a job fails → next stage stops
CI is basically:
Event-driven automation triggered by Git events.
5️⃣ Gradle — More Than a Build Tool
Gradle builds a task dependency DAG before running anything.
Two phases:
- Configuration phase → builds task graph
- Execution phase → runs tasks
If:
Task B dependsOn A
Execution order:
A → B
Everything again… graph-based.
🏗️ Build Flow Visualization
Standard structure:
build.gradle
settings.gradle
src/main/java
src/test/java
🔥 Final Insight From Today
Modern delivery pipeline:
Git Push
↓
CI Pipeline Triggered
↓
Gradle Build
↓
Tests Run
↓
Artifact Generated
↓
Deployment
You are not just coding.
You are part of a Software Delivery Lifecycle system.
💡 What Changed In My Thinking
- Git is graph theory.
- Rebase changes hashes because parent changes.
- CI is automated event execution.
- Gradle builds a task DAG before execution.
- Everything in DevOps is graph + automation.
If you’re a fresher:
Don’t just memorize commands.
Understand:
- Internal structure
- Execution flow
- Why systems behave the way they do
That’s how you move from beginner → engineer.
If you're learning Git, CI/CD, or build systems —
let’s connect and grow together 🚀





Top comments (0)