Re: [PATCH] Add suggestion to hard-to-understand error message
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:15
Johannes Schindelin [off-list ref] writes:
Dummies like me do not understand readily that "remote object abcdef... does not exist on local" means: "Hey, you did not pull this, did you?". So, add "(pull first?)" to that message.
I am ambivalent about this one. It is a special case of "remote
is not a strict subset of local" situation, so we might be
better if we just said the same as the other error message and
be done with it. On the other hand, the code does know the
difference of the two situations at this point, and it could be
argued that giving the same error is losing information.
Earlier I once rewound the "master" branch head by one commit
too much by mistake. The next push to the public server would
have given me a different error message, depending on whether I
pruned my private repository or not in between. For example,
after this sequence:
$ git commit -m 'initial'
$ git commit -m 'next'
$ git push remote master
$ git reset --hard HEAD^
$ git commit -m 'third but second'
If you do not prune at this point, then the remote commit "next"
still exists in the local repository (but not reachable). Then
$ git push remote master
would not say "pull first?". But if you prune local repository
before pushing, it would now say "pull first?".
In a sense, both are "pull first?" situation, and it probably is
more confusing to give different messages to the user in these
two cases. From the end-user point of view they are the same
"remote is not strict subset.".