Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ours vs Theirs Invalid in Rebase example? #4

Open
ruckus opened this issue Oct 7, 2020 · 2 comments
Open

Ours vs Theirs Invalid in Rebase example? #4

ruckus opened this issue Oct 7, 2020 · 2 comments

Comments

@ruckus
Copy link

ruckus commented Oct 7, 2020

In the Git Rebase example the user is on the feature branch and wants to rebase master on top.

Given that - the example of

$ git checkout --ours codefile.js

With the label

to select the changes done in master

Is incorrect. In this context --ours refers to the version of codefile.js thats ON our current branch which is actually feature.

So that label should really say

to select changes done in feature

Maybe I'm crazy too.

@Nitaym
Copy link
Owner

Nitaym commented Oct 7, 2020

Hi ruckus,

The user is on feature branch and wants to rebase feature on top of master
That's why --ours will select the "base branch" (master in this case)

It is VERY confusing

@ArnaudValensi
Copy link

According to my understanding, when we are on feature and we do git rebase master, git will do the following:

  • it takes the head of master an makes a temporary branch, which becomes the current branch
  • then it finds in the feature branch history, when it diverges from master
  • it applies to our temporary branch all the new commits from feature
  • then it uses the temporary branch as the new feature branch

So during the rebase process, HEAD is our temporary branch made from master. 'Ours' is always HEAD, so we can consider 'ours' to be master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants