Is merge without conflicts equivalent to rebase without conflicts?

Is it correct that a git merge will succeed with no conflicts if and only if the corresponding git rebase will succeed with no conflicts?

  • git clone from another directory
  • Staging Deleted files
  • How to re-push as drafts to gerrit?
  • Is there a way to output the result of a “git blame” to a text file?
  • Recommend a Git GUI client for Ubuntu 11.10
  • Git-archive remote end hung up
  • git in a web development team using 1 remote dev server and no local dev environment
  • git branching with gitolite, how to checkout from master when in develop
  • git “error: corrupt loose object” after moving a directory
  • How to clone CVS repository with empty directories
  • How do I push different branches to different heroku apps?
  • Why does git-pull manpage say “You never do your own development on branches that appear on the right hand side of a <refspec> colon on Pull: lines”?
  • One Solution collect form web for “Is merge without conflicts equivalent to rebase without conflicts?”

    No, and in fact there’s a trivial case where merge works fine but rebase doesn’t:

    ...--o--A   <-- mainline
          \
           B--C--!C   <-- branch
    

    where C is a commit that conflicts with A, and !C is its reversion. Merging branch back into mainline is equivalent in source-tree effect to merging commit B back into mainline, while rebasing copies both C (which conflicts with A) and then !C (which when being resolved, also conflicts with A).

    Of course, you can rebase interactively and simply drop both C and !C in this case, but in more complex chains, you can see how a commit might conflict with A but a subsequent commit might effectively resolve that conflict “in advance”, so that merging the tip of the branch back into the mainline has no conflicts.

    Git Baby is a git and github fan, let's start git clone.