🚀 DevOps Day 11 — Git Merge, Rebase & Pull Request Workflow (Real DevOps Flow)
Welcome to Day 11 of the DevOps Series.
In the previous blog, we learned about Git branching strategies.
Today, we’ll understand how code actually moves between branches using:
-
Git Merge
-
Git Rebase
-
Pull Request (PR) workflow
These concepts form the real DevOps development flow followed in organizations.
🔁 Why Merging Is Required
In real projects:
-
Developers work on feature branches
-
Main branch contains stable code
Once a feature is completed and tested, it must be combined back into the main branch.
This process is called merging.
🔀 Git Merge
Git merge is the safest and most commonly used method.
Example:
What happens?
-
Git combines feature branch changes into main
-
Creates a merge commit
-
Preserves complete history
Advantages:
-
Safe
-
Easy to understand
-
Used in most enterprise projects
Disadvantage:
-
Commit history can become messy in large projects
🔄 Git Rebase
Rebase is used to rewrite commit history.
Example:
What happens?
-
Feature branch commits are replayed on top of main
-
History becomes linear
-
No merge commit created
Advantages:
-
Clean commit history
-
Looks professional
Disadvantages:
-
Dangerous if used incorrectly
-
Should NOT be used on shared branches
👉 Rule:
Rebase local branches, merge shared branches.
⚔️ Merge vs Rebase (Simple Comparison)
| Feature | Merge | Rebase |
|---|---|---|
| History | Preserved | Rewritten |
| Safety | Very safe | Risky if misused |
| Common usage | Team branches | Local cleanup |
| Recommended for beginners | ✅ Yes | ⚠️ Use carefully |
🔐 What Is a Pull Request (PR)?
A Pull Request is a request to merge code from one branch into another.
Used mainly in:
-
GitHub
-
GitLab
-
Bitbucket
It enables:
-
Code review
-
Automated testing
-
Team discussion
-
Approval-based merging
🔄 Real DevOps Pull Request Workflow
Step 1️⃣ Developer creates feature branch
Step 2️⃣ Code is written and committed
Step 3️⃣ Push branch to GitHub
Step 4️⃣ Create Pull Request
-
Source: feature/payment
-
Target: main
Step 5️⃣ CI/CD pipeline runs
-
Build
-
Test
-
Lint
-
Security checks
Step 6️⃣ Code review
-
Team reviews changes
-
Suggestions provided
-
Changes updated if required
Step 7️⃣ Merge PR
-
Merge commit created
-
Feature branch deleted
This is the standard DevOps workflow followed in companies.
🧠 Why Pull Requests Are Important in DevOps
Pull Requests help in:
-
Preventing broken production code
-
Enforcing code quality
-
Enabling collaboration
-
Triggering automated pipelines
-
Maintaining audit history
Most organizations do not allow direct push to main branch.
🌍 Real-World DevOps Flow Summary
This flow ensures:
-
Stability
-
Speed
-
Quality
-
Accountability
✅ Summary
On Day 11, we learned:
-
What Git merge is
-
What Git rebase is
-
Difference between merge and rebase
-
What a pull request is
-
Real DevOps Git workflow used in companies
“DevOps is not just tools — it’s disciplined collaboration.”
Comments
Post a Comment