Stop Struggling with Merging Branches and Use these Git Commands instead

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 mea…


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


Print Share Comment Cite Upload Translate Updates
APA

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/

MLA
" » Stop Struggling with Merging Branches and Use these Git Commands instead." DEV Community | Sciencx - Monday March 7, 2022, https://www.scien.cx/2022/03/07/stop-struggling-with-merging-branches-and-use-these-git-commands-instead/
HARVARD
DEV Community | Sciencx Monday March 7, 2022 » Stop Struggling with Merging Branches and Use these Git Commands instead., viewed ,<https://www.scien.cx/2022/03/07/stop-struggling-with-merging-branches-and-use-these-git-commands-instead/>
VANCOUVER
DEV Community | Sciencx - » Stop Struggling with Merging Branches and Use these Git Commands instead. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/03/07/stop-struggling-with-merging-branches-and-use-these-git-commands-instead/
CHICAGO
" » Stop Struggling with Merging Branches and Use these Git Commands instead." DEV Community | Sciencx - Accessed . https://www.scien.cx/2022/03/07/stop-struggling-with-merging-branches-and-use-these-git-commands-instead/
IEEE
" » Stop Struggling with Merging Branches and Use these Git Commands instead." DEV Community | Sciencx [Online]. Available: https://www.scien.cx/2022/03/07/stop-struggling-with-merging-branches-and-use-these-git-commands-instead/. [Accessed: ]
rf:citation
» Stop Struggling with Merging Branches and Use these Git Commands instead | DEV Community | Sciencx | 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.

You must be logged in to translate posts. Please log in or register.