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

Re* git loses commits on git pull --rebase with Dictator and Lieutenants Workflow

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 29, 2015, 20:26 UTC
Message-ID
<xmqqegqde3ku.fsf_-_@gitster.dls.corp.google.com>
In-Reply-To
<loom.20150129T205443-493@post.gmane.org>
Dick <dick@mrns.nl> writes:
> I guess the git remote set-url --push command should contain some warning 
> about this.
Perhaps something like this would be good enough for a starter.
-- >8 --
Subject: Documentation/git-remote.txt: stress that set-url is not for triangular

It seems to be a common mistake to try using a single remote (e.g. 'origin') to fetch from one place (i.e. upstream) while pushing to another (i.e. your publishing point). That will never work satisfactory. Think about what refs/remotes/origin/* would mean in such a world---it fundamentally cannot reflect the reality. If it follows the state of your upstream, it cannot match what you have published, and vice versa.

Some low-quality websites may be spreading misinformation. Let's counter them by adding a few words to our documentation.

 - The description was referring to <oldurl> and <newurl>, but never
   mentioned <name> argument you give from the command line.  By
   mentioning "remote <name>", stress the fact that it is configuring
   a single remote.
 - Add a reminder that explicitly states that this is about a single
   remote, which the triangular workflow is not about.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 Documentation/git-remote.txt | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/Documentation/git-remote.txt b/Documentation/git-remote.txt
index cb103c8..a77607b 100644
--- a/Documentation/git-remote.txt
+++ b/Documentation/git-remote.txt
@@ -130,17 +130,25 @@ branches, adds to that list.
 
 'set-url'::
 
-Changes URL remote points to. Sets first URL remote points to matching
+Changes URLs for the remote. Sets first URL for remote <name> that matches
 regex <oldurl> (first URL if no <oldurl> is given) to <newurl>. If
-<oldurl> doesn't match any URL, error occurs and nothing is changed.
+<oldurl> doesn't match any URL, an error occurs and nothing is changed.
 +
 With '--push', push URLs are manipulated instead of fetch URLs.
 +
-With '--add', instead of changing some URL, new URL is added.
+With '--add', instead of changing existing URLs, new URL is added.
 +
-With '--delete', instead of changing some URL, all URLs matching
-regex <url> are deleted. Trying to delete all non-push URLs is an
-error.
+With '--delete', instead of changing existing URLs, all URLs matching
+regex <url> are deleted for remote <name>.  Trying to delete all
+non-push URLs is an error.
++
+Note that the push URL and the fetch URL, even though they can
+be set differently, must still refer to the same place.  What you
+pushed to the push URL should be what you would see if you
+immediately fetched from the fetch URL.  If you are trying to
+fetch from one place (e.g. your upstream) and push to another (e.g.
+your publishing repository), use two separate remotes.
+
 
 'show'::
 
Previous: DickNext: Eric Sunshine
Message 6 of 7 in “git loses commits on git pull --rebase with Dictator and Lieutenants Workflow”
  1. DickJan 28, 2015
  2. Chris PackhamJan 29, 2015
  3. Chris PackhamJan 29, 2015
  4. Junio C HamanoJan 29, 2015
  5. DickJan 29, 2015
  6. Re* git loses commits on git pull --rebase with Dictator and Lieutenants WorkflowJunio C Hamano, Jan 29, 2015
  7. Eric SunshineJan 29, 2015

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.