Say, you have main & feature as 2 branches.
Merge conflicts
If you want to merge feature branch into main, run following command.
git checkout main
git merge feature
This can result in merge conflicts.
To discard all changes in feature and accept everything on main, run following command.
git merge -Xours feature
To accept changes from feature branch, run below command.
git merge -Xtheirs feature
Rebase conflicts
If you want to rebase feature branch onto main, run below command.
git checkout feature
git rebase main
Again, this can result in merge conflicts.
To accept the changes in feature branch, run below command.
git rebase main -Xtheirs
To accept the changes in main branch, run below command.
git rebase main -Xours
Top comments (0)