This content originally appeared on DEV Community and was authored by DEV Community
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. Share 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!🌟
This content originally appeared on DEV Community and was authored by DEV Community
DEV Community | Sciencx (2022-03-07T20:21:20+00:00) Stop Struggling with Merging Branches and Use these Git Commands instead. Retrieved from https://www.scien.cx/2022/03/07/stop-struggling-with-merging-branches-and-use-these-git-commands-instead/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.