Skip to content

Instantly share code, notes, and snippets.

@fedir
Created January 7, 2020 12:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fedir/a891a5a0d139fe5b7360006afa6fc59b to your computer and use it in GitHub Desktop.
Save fedir/a891a5a0d139fe5b7360006afa6fc59b to your computer and use it in GitHub Desktop.
Resolving Git conflicts in production

Checking for possible conflicts

git fetch origin branch
git diff --name-only HEAD..origin/branch
git diff HEAD..origin/branch directory_foo/file_bar.ext

Using git vimdiff

git config merge.tool vimdiff
git config merge.conflictstyle diff3
git config mergetool.prompt fals
git mergetool

vimdiff commands

:diffg RE  " get from REMOTE
:diffg BA  " get from BASE
:diffg LO  " get from LOCAL

Force checkout of a file from a branch

git checkout --theirs path/to/file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment