Thread (1 message) 1 message, 1 author, 2016-06-15

Re: git push [rejected] question

From: Jeff King <hidden>
Date: 2016-06-15 22:44:15

On Tue, Feb 19, 2008 at 08:45:32AM -0600, Jason Garber wrote:
### Push from Issue/1 with non-fast-forward Issue/3 k###

  [jason@neon wc1]$ git push
  Counting objects: 5, done.
  Writing objects: 100% (3/3), 242 bytes, done.
  Total 3 (delta 0), reused 0 (delta 0)
  Unpacking objects: 100% (3/3), done.
  To /var/var-home/jason/Code/test/git/repo/.git
     142e136..c85b3dc  Issue/1 -> Issue/1
   ! [rejected]        Issue/3 -> Issue/3 (non-fast forward)
  error: failed to push to '/var/var-home/jason/Code/test/git/repo/.git'


The issue with the above error message is that it indicates to the
user that the push failed - even though the push was partially
successful.
Yes, the final line is somewhat ambiguous if read by itself. The
transport mechanism is abstracted, and we don't pass back to "git push"
the number of successful and error refs, so we know only that there was
an error.

However, the idea is that the detailed status information on each ref
has _already_ been output, and the user should look at that. And indeed,
in your example, we can see that Issue/1 was pushed successfully, while
Issue/3 was not.

So I think it is a matter of:

  1. The table's terseness did not make clear to you that Issue/1 was
     not only attempted for push, but was successfully pushed. This
     should probably be dealt with by a documentation update to
     git-push.

  2. The error message implies that the push failed, and a user might
     expect an all-or-nothing behavior. It might be enough to change
     this to just "error: failed to push some refs to ..." without
     actually counting the refs (as you suggested).
  [jason@neon wc1]$ git push
  To /var/var-home/jason/Code/test/git/repo/.git
     c85b3dc..c85b3dc  Issue/1 -> Issue/1 (Everything up-to-date)
   ! [rejected]        Issue/3 -> Issue/3 (non-fast forward)
  error: some errors encountered during push to '/var/var-home/jason/Code/test/git/repo/.git'.  See above for detail.

(it would be nice to see the status of each attempted branch if --all
was specified or implied as the default behavior)
Try "git push -v". We explicitly don't show up to date branches by
default because they tend to clutter the output.

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help