3

I am using smerge to resolve conflicts in order to apply merge. I am applying one by one for smerge-keep-mine to all conflicts, which I belive equivalent for git merge --strategy-option ours

[Q] Is it possible to apply smerge-keep-mine for all the conflicts by using a single keybinding?

config:

(defun smerge-try-smerge ()
  (save-excursion
    (goto-char (point-min))
    (when (re-search-forward "^<<<<<<< " nil t)
      (require 'smerge-mode)
      (smerge-mode 1))))
(add-hook 'find-file-hook 'smerge-try-smerge t)
(add-hook 'after-revert-hook 'smerge-try-smerge t)

(defun smerge-next-safe ()
    "returns t on success, nil otherwise"
  (condition-case err
      (not (smerge-next))
    ('error
     nil)))

(require 'vc)
(defun next-conflict ()  ;; key-binding
  (interactive)
  (let ((buffer (current-buffer)))
    (when (not (smerge-next-safe))
      (vc-find-conflicted-file)
      (if (eq buffer (current-buffer))
          (message "No conflicts found")
        (goto-char 0)
        (smerge-next-safe)))))

;; smerge-keep-current bound to smerge-command-prefix (RET) to keep the version the cursor is on.
;; smerge-keep-mine bound to smerge-command-prefix (m) to keep your changes.
;; smerge-keep-other bound to smerge-command-prefix (o) to keep other changes.

1 Answer 1

1

As far as I know, no smerge does not provide that functionality.

2
  • Can it be done in combination with additional packages?
    – alper
    Dec 5, 2020 at 15:24
  • I don't know about such a package.
    – tarsius
    Dec 5, 2020 at 17:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.