Updated: 2021-12-22
For enditing conflict in git, use smerge or ediff.
Smerge
Basic workflow:
- Open magit status with
SPC g gin Doom - Identify the mark with
UnmergedunderUnstagelist - Go to the file and press
Enterto open the file - The base command for Smerge is
C-c ^ - You will see the conflict and selecting the upper with
C-c ^ uand lower withC-c ^ l - To select all ‘conflicting’ changes press
C-c ^ a - To navigate the conflicts use
C-c ^ nandC-c ^ pfor next and previous conflict - To see all the keybindings use
C-c ^ h
With DOOM and hydra:
SPC g mfor SMerge will open hydra shortcuts.
Ediff
When you are in the file with conflict, type M-x smerge-ediff or M-x vc-resolve-conflicts. You will get 3 windows showing your HEAD and origin/HEAD
that you have fetched and the outcome or end product. You can select A or B to
select which you can to keep or delete. Use ? to see all the shortcuts to use.
This YouTube video explains it in more detail: Smerge and Ediff
Diff
To use diff directly from git comparing local and origin can be done with:
- Fetch changes from remotes
git fetch origin - Check log
git log master..origin/master - Show the changes
git diff master..origin/master - Merge changes
git merge origin/master
Else you could use git pull if you aren’t interested to check the changes
before merging.