   (with-current-buffer log-edit-parent-buffer
     (git-get-filenames (git-marked-files-state 'added 'deleted 'modified))))
 
+(defun git-append-sign-off (name email)
+  "Append a Signed-off-by entry to the current buffer, avoiding duplicates."
+  (let ((sign-off (format "Signed-off-by: %s <%s>" name email))
+        (case-fold-search t))
+    (goto-char (point-min))
+    (unless (re-search-forward (concat "^" (regexp-quote sign-off)) nil t)
+      (goto-char (point-min))
+      (unless (re-search-forward "^Signed-off-by: " nil t)
+        (setq sign-off (concat "\n" sign-off)))
+      (goto-char (point-max))
+      (insert sign-off "\n"))))
+
 (defun git-commit-file ()
   "Commit the marked file(s), asking for a commit message."
   (interactive)

        (merge-heads (git-get-merge-heads))
        (dir default-directory)
        (coding-system (git-get-commits-coding-system))
        (sign-off git-append-signed-off-by))
    (with-current-buffer buffer
      (when (eq 0 (buffer-size))

        (insert
         (propertize
          (format "Author: %s <%s>\n%s"
                  committer-name committer-email
                  (if merge-heads
                      (format "Parent: %s\n%s\n"
                              (git-rev-parse "HEAD")
