Search code examples
gitversion-controlrebase

What is "ours" and "their" while doing git rebase


I have applied the following commands, but have little confusion in doing rebase - what is ours and theirs in the following commands

git checkout app/dashboard-sprint-5
git rebase app/demandware

I know the current branch is app/dashboard-sprint-5 and when i apply the rebase.

app/dashboard-sprint-5 will be applied on the top of app/demandware.

What is ours and theirs in terms of branches.

I have checked the link but not satisfied


Solution

  • Briefly, when we are talking about rebase, ours means the base branch.

    So in your case ours will be app/demandware, since firstly git moves us there, and then applies changes from the app/dashboard-sprint-5, which will be theirs.

    For example, here the note from documentation about rebase and ours word:

    Because git rebase replays each commit from the working branch on top of the <upstream> branch using the given strategy, using the ours strategy simply discards all patches from the <branch>, which makes little sense.