From: Junio C Hamano Date: Thu, 28 Aug 2014 17:28:45 GMT Subject: Re: [PATCH] merge, pull: stop advising 'commit -a' in case of conflict Message-ID: In-Reply-To: <1409219218-9475-1-git-send-email-Matthieu.Moy@imag.fr> Matthieu Moy writes: > '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. > > While we're there, synchronize the 'git pull' and 'git merge' messages: > the first was ending with '... and make a commit.', but not the later. > > Signed-off-by: Matthieu Moy > --- >> - Hasty-and-careless new users will be incorrectly enticed to type >> the command given by "or use 'git commit -a'" at the end of this >> advice message without thinking. Perhaps it is safer to stop the >> sentence at "... and make a commit." and drop that last bit while >> there are conflicts still in the working tree files. We should >> use the current end-of-message only when all the conflicts have >> been resolved in the working tree. > > It was already on my todo-list, as a friend of mine semi-beginner with > Git complained about the mis-advice the other day, and I had to agree. > Eventually, git could detect that conflicts have been resolved, but > then that would be a different message, as not only "use git commit > -a" could be resurected, but "Fix them up in the work tree" should be > dropped when it is the case. This paragraph should be in the log message, shouldn't it, probably with s/could/should/? > I guess I'm just taking the low hanging fruit here ;-). I'd say it is more like scooping a fruit lying on the ground before it rots, but thanks anyway ;-) > advice.c | 3 +-- > git-pull.sh | 2 +- > 2 files changed, 2 insertions(+), 3 deletions(-) > > diff --git a/advice.c b/advice.c > index 9b42033..3b8bf3c 100644 > --- 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 '\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; > } > > diff --git a/git-pull.sh b/git-pull.sh > index 18a394f..4d4fc77 100755 > --- a/git-pull.sh > +++ b/git-pull.sh > @@ -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 ' > -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