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

Re: Minor annoyance with git push

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 20, 2008, 08:23 UTC
Message-ID
<7vzltwavf9.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<alpine.LSU.1.00.0802101303140.11591@racer.site>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> Hmm.  So that means that if an old-timer comes to help to a new-comer, 
> the old-timer will be surprised?

Actually, after carefully examining what I have been doing, I think this "somebody cries 'git push ;# nothing else' does not work, and old timer needs to remember to check one extra thing to help" has been a bit overblown.

To diagnose "git push ;# nothing else", you would already need to ask the following _anyway_:

 - On what branch are you?
 - Do you have "branch.$current_branch.remote"?
 - What is "branch.$current_branch.remote" set to?
 - Do you have remote.$that_remote.url?
   - If it is http://, do you have very new version of curl
     library, often not even in distro?
   - If it is http://, does it end with '/'?
   - If it is http://, do you have DAV enabled over there?
   - If it is host:path, does your non-interactive ssh get
     appropriate PATH at the other end?
   - Is your username there the same as local?  Otherwise do you
     have "User your_name_over_there" set up in your
     $HOME/.ssh/config?
   - 47 other questions about transfers.
 - Do you have remote.$that_remote.push?
 - What local branches do you have?
 - What local branches does $that_remote have?

So it is not _so_ unreasonable if we add an extra configuration or two to this mix.

What configuration semantics is reasonable is a different matter. Let's back up a bit.

The "matching" semantics has been advertised as a convenient way to keep track of which branches you would want publish and which ones to keep private without having to have extra configuration. This is very true for people whose workflow is based on _owned_ public distribution points. The destination is controlled by you and you alone, and after pushing the branches you want to show out explicitly, the destination repository _remembers_ which branches you are interested in publishing for later "matching" pushes. When you are no longer interested in showing that work, you remove it from the remote and matching and that (1) stops publishing and at the same time (2) remembers you are no longer interested in publishing.

However, when you allow others to push into the destination, the set of branches there obviously cannot serve as your private configuration anymore. So "matching" can never be a convenient way if your push is to a shared repository.

Which would mean that "matching" is not a personal taste nor even per-repository matter. I think it is reasonable to set this per-remote.

    You may have a repository you use during daytime on your
    desktop, and the repository may have more than one remotes
    defined.  "origin" may point to a shared repository you push to
    and fetch from in order to work together with others, "backup"
    may point to another repository on your server you push your
    work into, and "satellite" may point to yet another repository
    on your notebook when you are done for the day and take your WIP
    along with you.
    You may not want "matching" when interacting with the shared
    repository (if you always want "current only" is a different
    matter, but let's pretend you do), but you would want
    "matching" when pushing back to "satellite", and you would
    want "mirror" when pushing to "backup".

So perhaps we can have "remote.*.push" that says "current" in some way. Tentatively let's say the syntax is like this:

	[remote "origin"]
        	url = server.oss.example.org:/pub/project.git/
                push = HEAD
                fetch = +refs/heads/*:refs/remotes/origin/*
	[remote "backup"]
        	url = server.example.com:/home/me/mine.git/
                push = +refs/*:refs/*
	[remote "satellite"]
        	url = notebook.example.com:/home/me/mine.git/
	[branch "master"]
        	remote = "origin"
                merge = refs/heads/master
	[branch "ticket-47"]
               	remote = "origin"
                merge = refs/heads/ticket-47
While on "master", "git push" will say...
	Ah, you are too lazy to say where to push to.
	branch.master.remote says "origin", so that is it.
	And you are too lazy to say what to push either.
	remote.origin.push says HEAD which is a special token
	that means the current branch.
	Let's pretend you told me "git push origin master"

I was hoping we can do without the "remote.*.push = HEAD" if we can detect the remote is a shared repository while talking to it, but I think it is a bit too much magic, because we cannot visualize what the pushing side and the receiving side are negotiating.

Putting this "push = HEAD" by default when "git clone" and "git remote add" creates the [remote "$remote"] section is probably possible, and at that stage we may even be able to do the "if the other end is shared, then set this up automagically", as the result of the magic can be inspected in the resulting config file.

Previous: Jeff KingNext: Johannes Schindelin
Message 52 of 71 in “Minor annoyance with git push”
  1. Martin LanghoffFeb 8, 2008
  2. Martin LanghoffFeb 8, 2008
  3. Junio C HamanoFeb 8, 2008
  4. Steffen ProhaskaFeb 9, 2008
  5. Junio C HamanoFeb 10, 2008
  6. Johannes SchindelinFeb 10, 2008
  7. Johannes SchindelinFeb 8, 2008
  8. Martin LanghoffFeb 8, 2008
  9. Mike HommeyFeb 8, 2008
  10. SeanFeb 8, 2008
  11. Steffen ProhaskaFeb 8, 2008
  12. Johannes SchindelinFeb 8, 2008
  13. Martin LanghoffFeb 8, 2008
  14. Johannes SchindelinFeb 8, 2008
  15. Jeff KingFeb 9, 2008
  16. Jeff KingFeb 9, 2008
  17. Johannes SchindelinFeb 9, 2008
  18. Jeff KingFeb 9, 2008
  19. Steffen ProhaskaFeb 9, 2008
  20. Jeff KingFeb 9, 2008
  21. Junio C HamanoFeb 9, 2008
  22. Jeff KingFeb 9, 2008
  23. Martin LanghoffFeb 9, 2008
  24. Johannes SchindelinFeb 9, 2008
  25. Junio C HamanoFeb 10, 2008
  26. Jeff KingFeb 10, 2008
  27. Johannes SchindelinFeb 10, 2008
  28. [RFC] checkout to notice forks (Re: Minor annoyance with git push)Junio C Hamano, Feb 17, 2008
  29. Daniel BarkalowFeb 17, 2008
  30. Junio C HamanoFeb 17, 2008
  31. Daniel BarkalowFeb 17, 2008
  32. Junio C HamanoFeb 17, 2008
  33. Daniel BarkalowFeb 17, 2008
  34. Jeff KingFeb 17, 2008
  35. Santi BéjarFeb 20, 2008
  36. Martin LanghoffFeb 19, 2008
  37. checkout: tone down the "forked status" diagnostic messagesJunio C Hamano, Feb 20, 2008
  38. Jeff KingFeb 21, 2008
  39. checkout: updates to tracking reportJunio C Hamano, Feb 21, 2008
  40. Jay SoffianFeb 21, 2008
  41. Daniel BarkalowFeb 21, 2008
  42. Jay SoffianFeb 21, 2008
  43. Steffen ProhaskaFeb 9, 2008
  44. Johannes SchindelinFeb 9, 2008
  45. Junio C HamanoFeb 10, 2008
  46. Johannes SchindelinFeb 10, 2008
  47. Jeff KingFeb 10, 2008
  48. Johannes SchindelinFeb 10, 2008
  49. Jeff KingFeb 10, 2008
  50. Johannes SchindelinFeb 10, 2008
  51. Jeff KingFeb 10, 2008
  52. Junio C HamanoFeb 20, 2008
  53. Johannes SchindelinFeb 20, 2008
  54. Jay SoffianFeb 20, 2008
  55. Johannes SchindelinFeb 20, 2008
  56. Steven WalterFeb 21, 2008
  57. Johannes SchindelinFeb 22, 2008
  58. Jeff KingFeb 20, 2008
  59. Junio C HamanoFeb 20, 2008
  60. Jeff KingFeb 20, 2008
  61. Jeff KingFeb 20, 2008
  62. Junio C HamanoFeb 20, 2008
  63. Jeff KingFeb 20, 2008
  64. Wincent ColaiutaFeb 10, 2008
  65. Steven WalterFeb 10, 2008
  66. Johannes SchindelinFeb 10, 2008
  67. Johannes SchindelinFeb 10, 2008
  68. Wincent ColaiutaFeb 10, 2008
  69. Jeff KingFeb 10, 2008
  70. Junio C HamanoFeb 10, 2008
  71. Jeff KingFeb 10, 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.