Mohammad Gufran Jahangir July 27, 2025 0

In Azure DevOps (and Git in general), when merging branches, there are several types of merge strategies or commit behaviors beyond just fast-forward. Here’s a breakdown:


✅ 1. Fast-Forward Merge

  • Used when: The target branch is directly ahead of the source branch (no new commits in target).
  • Result: Moves the branch pointer forward; no merge commit created.
  • Cleanest history.

✅ 2. Merge Commit

  • Used when: The branches have diverged.
  • Result: A new merge commit is created, combining both histories.
  • Pros: Preserves the full context of the branches.
  • Command: git merge (default without --ff-only)

✅ 3. Squash Merge

  • Used when: You want to flatten all commits into a single commit in the target branch.
  • Result: Clean target history, but original commits are not preserved.
  • Common for: Feature branches.
  • Command: git merge --squash

✅ 4. Rebase and Merge

  • Used when: You want to reapply commits from the source onto the latest commit of the target branch.
  • Result: Linear history without merge commits.
  • Risk: Can be confusing in shared branches due to rewritten history.
  • Command: git rebase followed by git merge

✅ 5. Manual Merge (Resolve Conflicts)

  • Used when: Automatic merge fails due to conflicts.
  • Result: Developer must resolve conflicts manually and then commit the resolution.
  • Can occur in: Any merge type.

🔍 Comparison Table

Merge TypeCreates Merge CommitKeeps Individual CommitsLinear HistoryUse Case
Fast-ForwardSimple updates
Merge CommitPreserve full history
Squash Merge✅ (1 commit)Clean history
Rebase + MergeClean, linear, retains commits

Category: 
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments