Reputation: 1448
I want to use theirs
as the default strategy for git merge. I don't want to specify merge using theirs
every time.
git merge -X theirs master
Is there any way to set it up globally so that i can only use
git merge master
without -X theirs
.
Upvotes: 2
Views: 1130
Reputation: 47956
Perhaps you'll be able to accomplish this with the .gitconfig
file and an alias definition:
Try to place this in your ~/.gitconfig
file:
[alias]
merget = merge -X theirs
This alias maps the git command merget
to merge -X theirs
so all you'd need to execute would be
git merget master
The merget
would be replaced with the actual command so that is the only command you would have to specify.
The same thing could be done with a bash alias defined in your .bashrc
file:
alias merget='merge -X theirs'
In a similar way, executing git merget master
would result in the desired command because again, the merget
part will be replaced by the aliased command.
I chose merget
just as an example (merget
like merge theirs
) - any alias that would help remind you what the command does can be used for both the .gitconfig
and .bashrc
aliases.
Upvotes: 3
Reputation: 18550
If its just for a branch you can use the
branch.<name>.mergeOptions
Option of git config
This takes the same options as merge and applys them as default
https://git-scm.com/docs/git-config
Upvotes: 1