reddit / emacs

What does the [c]onflict option means when resolving a git conflict?

x-yuri · 2022-10-25 14:45
I ran into it when resolving a deleted-by-them conflict. I pressed k on the file, and emacs (magit) asked: > For b2 checkout: [o]ur stage, [t]heir stage, [c]onflict, or [C-g] to abort What does "conflict" means? A script that creates a repository with such a conflict: ```sh mkdir a cd a git init echo a > a && git add a && git commit -m a echo b > b && git add b && git commit -m b echo c > c && git add c && git commit -m c git rm b && git commit -m x GIT_SEQUENCE_EDITOR="sed -ri '2s/pick/e/'" git rebase -i --root git mv b b2 && EDITOR=: git commit --amend git rebase --continue ```
manphiz · 2022-10-25 22:52
I think in magit it will launch ediff let you resolve the conflict manually?
tarsius_ · 2022-10-25 23:12
This is useful after you have already tried to resolve the conflict and realize that you made a mistake and want to start over. Choosing `c` restores the conflict as it was first presented to you.
x-yuri · 2022-10-26 10:58
Indeed. It appears I noticed the feature in a situation where it can't help. Or is not made to help. To create a repository with a more typical conflict: ``` rm -rf a mkdir a cd a git init echo a > a && git add a && git commit -m a echo a1 > a && git add a && git commit -m a1 set -x GIT_SEQUENCE_EDITOR="sed -ri '1s/pick/e/'" git rebase -i --root echo a2 > a && git add a && EDITOR=: git commit --amend git rebase --continue || true ```