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

Re: basic question about push

From
Jay Soffian <jaysoffian@gmail.com>
Date
Jan 24, 2010, 23:59 UTC
Message-ID
<76718491001241559u103d2e8j38687b41bd5401a1@mail.gmail.com>
In-Reply-To
<20100124081513.GA10700@coredump.intra.peff.net>
On Sun, Jan 24, 2010 at 3:15 AM, Jeff King <peff@peff.net> wrote:
Show 12 quoted lines
> On Sun, Jan 24, 2010 at 07:04:59AM +0000, Russ Paielli wrote:
>
>> warning: updating the current branch
>> [...]
>> What does this mean in English? And what is the correct way to transfer my
>> revisions from my home computer to my work computer? Thanks.
>
> It means your workflow will cause problems as the pusher magically
> changes your repository's concept of "the latest commit" behind the
> pushee's back. The workflow you want is described here:
>
>  http://git.wiki.kernel.org/index.php/GitFaq#push-is-reverse-of-fetch

Aside, and I think we've discussed this before, but I wonder if it would make sense to:

a) Add an option to clone such as "-p [<name>] | --push-as[=<name>]" where <name> defaults to $(uname -n | cut -f1 -d.) This would setup the cloned repo with a push refspec "+refs/heads/*:refs/remotes/<name>/*". e.g.:

$ git clone -o host1 -p host2 ssh://host1/~/repo.git
$ cat repo/.git/config
...
[remote "host1"]
	url = ssh://host1/~/repo.git
	fetch = +refs/heads/*:refs/remotes/host1/*
	push = +refs/heads/*:refs/remotes/host2/*

b) The controversial part: make this option the default the default when cloning from a non-bare repo. There would need to be some way to turn it off.

Of course, I'm not sure this would be any less confusing for users. Would they wonder why they have to merge to see their pushed changes reflected on the pushed-to repo?

It does nicely make push symmetric to fetch between two non-bare repos though, and I think maybe that makes more sense.

j.
Previous: Jeff KingNext: Jeff King
Message 5 of 6 in “basic question about push”
  1. Russ PaielliJan 24, 2010
  2. Jeff KingJan 24, 2010
  3. Junio C HamanoJan 24, 2010
  4. Jeff KingJan 25, 2010
  5. Jay SoffianJan 24, 2010
  6. Jeff KingJan 25, 2010

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.