So I am still newish with git and have just discovered the rebase
option to update a branch with master
.
I ran:
git checkout mybranch
git rebase master
Now I have a few merge conflicts. Is this the same as fixing normal merge conflicts? I want to accept masters
changes. I get something like
<<<<<<< 6tyuhjhgty54rtfghgftr
=======
<bunch of code here>
>>>>>>> Updates from Company
Which is which?
If you want to replace your changes with their changes as a whole for a file, then you can do a git checkout --theirs -- path-of-file
In your example above, the code above the ===='s is yours and the code below is the incoming code.
When you call git rebase master
from your branch, the first thing git is going to do is checkout the master
branch.
This means that the changes made on master
are --ours
and the changes made on mybranch
are --theirs
.
Alwyn is correct in saying that from there, if you want to, you can call git checkout --theirs/--ours -- path/of/file
depending on whether you want the changes from mybranch
or master
.
in your master branch you need to use
git pull origin master
git checkout mybranch
git rebase -X ours master
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.