OSDN Git Service

merge, pull: stop advising 'commit -a' in case of conflict
authorMatthieu Moy <Matthieu.Moy@imag.fr>
Thu, 28 Aug 2014 09:46:58 +0000 (11:46 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 28 Aug 2014 17:29:53 +0000 (10:29 -0700)
'git commit -a' is rarely a good way to mark conflicts as resolved:
the user anyway has to go manually through the list of conflicts to
do the actual resolution, and it is usually better to use "git add"
on each files after doing the resolution.

On the other hand, using 'git commit -a' is potentially dangerous,
as it makes it very easy to mistakenly commit conflict markers
without noticing, and even worse, the user may have started a merge
while having local changes that do not overlap with it in the
working tree.

While we're there, synchronize the 'git pull' and 'git merge'
messages: the first was ending with '...  and make a commit.', but
not the latter.

Eventually, git should detect that conflicts have been resolved in
the working tree and tailor these messages further.  Not only "use
git commit -a" could be resurected, but "Fix them up in the work
tree" should be dropped when it happens.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
advice.c
git-pull.sh

index 9b42033..3b8bf3c 100644 (file)
--- a/advice.c
+++ b/advice.c
@@ -86,8 +86,7 @@ int error_resolve_conflict(const char *me)
                 * other commands doing a merge do.
                 */
                advise(_("Fix them up in the work tree, and then use 'git add/rm <file>'\n"
-                        "as appropriate to mark resolution and make a commit, or use\n"
-                        "'git commit -a'."));
+                        "as appropriate to mark resolution and make a commit."));
        return -1;
 }
 
index 18a394f..4d4fc77 100755 (executable)
@@ -20,7 +20,7 @@ die_conflict () {
     if [ $(git config --bool --get advice.resolveConflict || echo true) = "true" ]; then
        die "$(gettext "Pull is not possible because you have unmerged files.
 Please, fix them up in the work tree, and then use 'git add/rm <file>'
-as appropriate to mark resolution, or use 'git commit -a'.")"
+as appropriate to mark resolution and make a commit.")"
     else
        die "$(gettext "Pull is not possible because you have unmerged files.")"
     fi