git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git push [rejected] question

From
Jeff King <peff@peff.net>
Date
Feb 19, 2008, 15:21 UTC
Message-ID
<20080219152154.GB24499@sigill.intra.peff.net>
In-Reply-To
<E7DE807861E8474E8AC3DC7AC2C75EE50542F62D@34093-EVS2C1.exchange.rackspace.com>
On Tue, Feb 19, 2008 at 08:45:32AM -0600, Jason Garber wrote:
Show 16 quoted lines
> ### 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).
Show 8 quoted lines
>   [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
Previous: Jay Soffian
Message 19 of 19 in “git push [rejected] question”
  1. Jason GarberFeb 18, 2008
  2. Jeff KingFeb 19, 2008
  3. Jay SoffianFeb 19, 2008
  4. Jeff KingFeb 19, 2008
  5. Jay SoffianFeb 19, 2008
  6. Jeff KingFeb 19, 2008
  7. Johannes SchindelinFeb 19, 2008
  8. push: annoy all users by deprecating the default semanticsJohannes Schindelin, Feb 19, 2008
  9. Jason GarberFeb 19, 2008
  10. Johannes SchindelinFeb 19, 2008
  11. Jeff KingFeb 19, 2008
  12. Johannes SchindelinFeb 19, 2008
  13. Jeff KingFeb 19, 2008
  14. Govind SalinasFeb 20, 2008
  15. Junio C HamanoFeb 20, 2008
  16. Govind SalinasFeb 20, 2008
  17. Junio C HamanoFeb 20, 2008
  18. Jay SoffianFeb 19, 2008
  19. Jeff KingFeb 19, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.