Git -Xours -Xtheirs arguments

Git provides a helpful argument to prefer one branch or the other to “clobber” merge conflicts:

git merge main -Xours
git merge main -Xtheirs

I always get confused what the “X” means. I always assume “X” means mark which branch to clobber. Like “X” out their branch. Or “X” out our branch. Please wipe this mnemonic from your brain!

“X” means “PREFER”

“PREFER” the changes in their branch or “PREFER” the changes in our branch.

Jeez!

Links

Alias for Git sanity

Git command line is pretty confusing. Here are some aliases that I found helpful that normalize it with other command line commands and add a little bit better context.

Open global .gitconfig file:

$ open ~/.gitconfig

If there isn’t an [alias] section already, add one:

[alias]
  cd = checkout
  ll = branch
  ls = branch
  delete-merged = !git branch --merged | egrep -v \"(^\\*|master|development)\" | xargs git branch -d
  mk = checkout -b
  new-up = !git push -u origin `git symbolic-ref --short HEAD`
  stage = add
  unstage = reset HEAD

Update 2018-07:

To set VS Code as the default editor for commit and merge messages:

[core]
  editor = code --wait