Git Merge: When You Want Real History (Safely)

Suman SharmaSuman Sharma

Git Merge: When You Want Real History (Safely)

git merge combines two branches.

If your feature branch and main diverged, Git creates a merge commit that has:

  • one parent from the feature branch
  • one parent from main
Illustration comparing Git merge and rebase history

The most common merge command

git switch main git merge feature/auth

Fast-forward vs merge commit

  • Fast-forward happens when main hasn’t moved since you branched off. Git just moves the pointer.
  • Merge commit happens when both branches have new commits. Git preserves both histories and records the merge.

Next: merge vs rebase

For the deeper “which one should you use and when” answer:

Contact

Get in Touch

Want to call me? book a call and I'll respond in the available time slot. I will ignore all soliciting.