37

There is a similar question to this one but its scope is too general and the response overly complicated. My question is very punctual

When from my branch MyBranch and doing a rebase like git rebase master and having a conflict

which is incoming change? and which is current change?

Please don't close this question linking it to previously said overly general and overly complicated answer that covers rebases, merges, etc. This question is ONLY about rebase

1 Answer 1

48

When from my branch MyBranch and doing a rebase like git rebase master and having a conflict which is incoming change? and which is current change?

When rebasing MyBranch onto master, "incoming" is the branch you have checked out, which is MyBranch, and "current" is master.

The reason is because of what rebase actually does behind the scenes. Rebase first resets your branch to master, and then replays each of the commits from MyBranch onto master. If there is a conflict while doing that rebase, then at that moment, master is now your temporary "current" and MyBranch is "incoming" because you're replaying those commits. Once the rebase completes you'll have MyBranch checked out again and back to where it would be considered "current" again.

The reason the explanation is oftentimes included with merging, is because the labels are flipped, and are perhaps more intuitive, for merge. "Incoming" is the branch you're merging in, and "current" is your branch.

2
  • 1
    I was rebasing and this flipped terminology was confusing the hell out me until your comment. The choice of terminology should have been made from the perspective of the end-user not what's behind the scene.
    – Parham
    Commented May 14 at 11:49
  • 1
    @Parham Note that "behind the scenes" becomes front and center when you have a conflict. Another way to think about it is when you cherry-pick a commit and have a conflict, the commit you are cherry-picking is "incoming". (I believe that is intuitive.) When you rebase onto another branch, you are cherry-picking each of the commits from your branch, making your commits "incoming". Perhaps the best overall solution from a UI standpoint would be for tools to display the branch names along with "incoming" and "current", when applicable. (Some tools do this.)
    – TTT
    Commented May 15 at 18:28

Not the answer you're looking for? Browse other questions tagged or ask your own question.