APURV
  • Home
  • Journey
  • Projects
  • Blogs
  • Interview
  • Exams
Resume
APURV

Building scalable, secure, and production-ready cloud infrastructure. Automation first.

NAVIGATION

HomeExperienceProjectsCertificationsSkills

TECH STACK

AWSGCPK8sCI/CDLinuxDocker

CONNECT

LinkedInGitHubEmailResume

© 2026 Apurv Gujjar. All rights reserved.
Apurv Gujjar
Apurv GujjarDevOps & Cloud Engineer
|Interview Documentation
Portfolio
Handbooks
🎯Linux🐙Git & GitHub🤖GitHub Actions🌐Networking☁AWS🛠Terraform🐳Docker☸Kubernetes📊Monitoring🛡DevSecOps💰Cost Optimization🚨Incident Scenarios👤HR & Behavioral☁GCP🐍Python
Interview DocumentationGit & GitHubHow do you explain the difference between 'git merge' and 'git rebase'? What is the Golden Rule of Rebasing?
Back to all Git & GitHub questions
Q3

How do you explain the difference between 'git merge' and 'git rebase'? What is the Golden Rule of Rebasing?

💬Answer

Both commands integrate changes from one branch into another, but they do it in fundamentally different ways:

  • git merge:
    • Combines the histories by executing a three-way merge and creating a new merge commit (if not fast-forward).
    • Pros: Preserves the complete, chronological history of what happened and when. Non-destructive.
    • Cons: Can result in a cluttered history graph with many overlapping merge lines.
  • git rebase:
    • Moves the entire base of the feature branch to begin at the tip of the target branch, effectively rewriting history. It plays back commits one-by-one onto the new base.
    • Pros: Results in a perfectly clean, linear history graph without unnecessary merge commits.
    • Cons: Rewrites history. Golden Rule of Rebasing: Never rebase branches that have been pushed to a public/shared repository, as it corrupts collaborators' local histories.
Initial State:
      A---B---C  (main)
           \
            D---E  (feature)
After git merge main into feature:
      A---B---C  (main)
           \   \
            D---E---F  (feature, F is a merge commit)
After git rebase main on feature:
      A---B---C  (main)
               \
                D'---E' (feature, commits D and E are rewritten)

Related Git & GitHub Questions

View All Git & GitHubQuestions →
Q1

What is Git, and how does its distributed model differ from older centralized version control systems?

Q2

# Why it is Used:

Q3

What is version control, and why is it considered the absolute starting point for any DevOps pipeline?

Q4

Can you explain the main architectural areas of Git? How do files transition between them?

Apurv Gujjar - DevOps & Cloud Engineer
Created by

Apurv Gujjar

DevOps & Cloud Engineer

Specialized in:DevOpsAWSGCPKubernetesTerraformDocker
View Portfolio