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

Re: [RFC] Reverting "git push logic change"?

From
Junio C Hamano <junkio@cox.net>
Date
Jan 22, 2006, 21:31 UTC
Message-ID
<7vu0bw9ch7.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<7vr770c8db.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> writes:
> ...  This is a user error but that is not their fault.  It
> means that we need to document this better:
I hope something like this is clear enough?

-- >8 -- [PATCH] Recommend to remove unused `origin` in a shared repository

It is a common mistake to leave an unsed `origin` branch behind if a shared public repository was created by first cloning from somewhere else. Subsequent `git push` into it with the default "push all the matching ref" would push the `origin` branch from the developer repository uselessly.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
diff --git a/Documentation/tutorial.txt b/Documentation/tutorial.txt
index b8fa299..35579cc 100644
--- a/Documentation/tutorial.txt
+++ b/Documentation/tutorial.txt
@@ -1667,6 +1667,26 @@ complain, telling you that the remote `m
 fast forward.  You need to pull and merge those other changes
 back before you push your work when it happens.
 
+The `git push` command without any explicit refspec parameter
+pushes the refs that exist both in the local repository and the
+remote repository.  So the last `push` can be done with either
+one of these:
+------------
+$ git push origin
+$ git push repo.shared.xz:/pub/scm/project.git/
+------------
+as long as the shared repository does not have any branches
+other than `master`.
+[NOTE]
+============
+If you created your shared repository by cloning from somewhere
+else, you may have the `origin` branch.  Your developers
+typically do not use that branch; remove it.  Otherwise, that
+would be pushed back by the `git push origin` because your
+developers' repository would surely have `origin` branch to keep
+track of the shared repository, and would be counted as "exist
+on both ends".
+============
 
 Advanced Shared Repository Management
 -------------------------------------
Previous: Junio C HamanoNext: sean
Message 9 of 13 in “"git push" logic changed?”
  1. Greg KHJan 20, 2006
  2. Junio C HamanoJan 21, 2006
  3. Greg KHJan 21, 2006
  4. Junio C HamanoJan 21, 2006
  5. Junio C HamanoJan 21, 2006
  6. [RFC] Reverting "git push logic change"?Junio C Hamano, Jan 21, 2006
  7. Daniel BarkalowJan 22, 2006
  8. Junio C HamanoJan 22, 2006
  9. Junio C HamanoJan 22, 2006
  10. seanJan 22, 2006
  11. Junio C HamanoJan 22, 2006
  12. Junio C HamanoJan 23, 2006
  13. Greg KHJan 24, 2006

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.