Stop Conflicting Merge Requests and Use These Commands instead ⤵️
-Xtheirs
Using the -Xtheirs
flag when running git rebase
or git pull
, will favor the incoming changes from the branch you are rebasing/pulling from. Doing this means you accept any incoming changes from the branch you are rebasing/pulling off of. Say goodbye to going through to accept them all manually. Here is an example of how the command can be used:
git rebase -Xtheirs <branch you are rebasing/accepting changes>
or
git pull origin <branch you are rebasing/accepting changes> -Xtheirs
-Xours
Similarly using the -Xours
flag when running git rebase
or git pull
, will favor the YOUR changes when rebasing with another branch. Doing this means you are accepting and keeping YOUR changes while pulling or rebasing from another branch. Here is an example of how the command can be used:
git rebase -Xours <branch you are rebasing/accepting changes>
or
git pull origin <branch you are rebasing/accepting changes> -Xours
Conclusion
I hope this tiny tutorial helps make the tedious process of merging branches can be a tad bit easier. Let me know what you think of these commands!🌟
Top comments (0)