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

[PATCH] git-push.txt: describe how to default to pushing only current branch

From
Chris Johnsen <chris_johnsen@pobox.com>
Date
Mar 14, 2009, 01:27 UTC
Message-ID
<1236994051-27346-1-git-send-email-chris_johnsen@pobox.com>
In-Reply-To
<20090313164941.GA16504@sigill.intra.peff.net>

--- Jeff King <peff@peff.net> writes:

>   git config remote.$remote.push HEAD
> 
> It isn't mentioned in the git-push manpage; maybe a documentation
> patch to give an example using HEAD would make sense?
Here is a patch. It also attempts to document bare 'git push'.
In the resulting manpage the inline commands are not very
obvious (the HTML looks OK though). There is some sort of
formatting in there, but it does not seem to display any
differently from the surrounding text when I use man to view it
on my system.  Would it be better to do something like wrap
double quotes around the inline commands to help readers viewing
the manpage?
---
 Documentation/git-push.txt |   26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt
index 4e7e5a7..fd53c49 100644
--- a/Documentation/git-push.txt
+++ b/Documentation/git-push.txt
@@ -24,8 +24,8 @@ every time you push into it, by setting up 'hooks' there.  See
 documentation for linkgit:git-receive-pack[1].
 
 
-OPTIONS
--------
+OPTIONS[[OPTIONS]]
+------------------
 <repository>::
 	The "remote" repository that is destination of a push
 	operation.  This parameter can be either a URL
@@ -187,6 +187,28 @@ reason::
 Examples
 --------
 
+git push::
+	Works like `git push <remote>`, where <remote> is the
+	current branch's remote (or `origin`, if no remote is
+	configured for the current branch).
+
+git push origin::
+	Without additional configuration, works like
+	`git push origin :`.
++
+The default behavior of this command when no <refspec> is given can be
+configured by setting the `push` option of the remote.
++
+For example, to default to pushing only the current branch to `origin`
+use `git config remote.origin.push HEAD`.  Any valid <refspec> (like
+the ones in the examples below) can be configured as the default for
+`git push origin`.
+
+git push origin :::
+	Push "matching" branches to `origin`. See
+	<refspec> in the <<OPTIONS,OPTIONS>> section above for a
+	description of "matching" branches.
+
 git push origin master::
 	Find a ref that matches `master` in the source repository
 	(most likely, it would find `refs/heads/master`), and update
-- 
1.6.2
Previous: Jeff KingNext: Junio C Hamano
Message 17 of 27 in “Not pushing all branches?”
  1. Peter KreftingMar 13, 2009
  2. Imran M YousufMar 13, 2009
  3. Peter KreftingMar 13, 2009
  4. Johannes SchindelinMar 13, 2009
  5. Finn Arne GangstadMar 13, 2009
  6. John TapsellMar 13, 2009
  7. Johannes SchindelinMar 13, 2009
  8. John TapsellMar 13, 2009
  9. Johannes SchindelinMar 13, 2009
  10. John TapsellMar 13, 2009
  11. Michael J GruberMar 13, 2009
  12. Johannes SchindelinMar 13, 2009
  13. Junio C HamanoMar 13, 2009
  14. Miles BaderMar 14, 2009
  15. Jeff KingMar 17, 2009
  16. Jeff KingMar 13, 2009
  17. git-push.txt: describe how to default to pushing only current branchChris Johnsen, Mar 14, 2009
  18. Junio C HamanoMar 14, 2009
  19. Jeff KingMar 14, 2009
  20. Jeff KingMar 14, 2009
  21. Chris JohnsenMar 15, 2009
  22. Chris JohnsenMar 15, 2009
  23. Jeff KingMar 17, 2009
  24. Junio C HamanoMar 14, 2009
  25. Jeff KingMar 14, 2009
  26. Junio C HamanoMar 16, 2009
  27. git-push.txt: describe how to default to pushing only current branchChris Johnsen, Mar 15, 2009

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.