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

git push vs. slow connection times - local commit resolution is too late

From
Eric Blake <eblake@redhat.com>
Date
Jul 14, 2011, 13:22 UTC
Message-ID
<4E1EEDAA.1000204@redhat.com>

I've been bitten several times by this bug now, so I'll report it in the hopes that someone knows what to do to patch it.

Scenario - I have a remote repository that takes on the order of 10 seconds to connect to, for any operation like 'git push'. I know that there is a lag, so I intentionally have two terminals open, both visiting the same directory, one for interaction with the remote, and the other for acting on the local repository, with the hope that I can do useful work in the second terminal rather than idly waiting on the lag in the first terminal.

In the middle of rebasing a patch series, where I want to incrementally push the patches that I have gotten through so far, I used the following steps:

On the remote-interaction terminal, I push the current state of my tree: git push remote HEAD:master

On the local-interaction terminal, I move on to the next patch: git rebase --continue

then, to my horror, I find out that the commit I'm working on locally has already been pushed! Why? Because 'git push remote HEAD:master' does not determine which commit 'HEAD' refers to until _after_ it has established a connection to remote, but the stupid 10-second lag was long enough that my actions in my second terminal have changed HEAD in the meantime.

I would really love it if 'git push' would resolve all local references _prior_ to trying to connect to the remote server, rather than waiting until after the connection. That way, my remote-interaction terminal can truly be a type-it-and-forget-it terminal, where the push action I requested reflects the state of the tree at the time I requested it, rather than picking up changes made later in another terminal.

-- 
Eric Blake   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org
Next: Phil Hord
Message 1 of 4 in “git push vs. slow connection times - local commit resolution is too late”
  1. Eric BlakeJul 14, 2011
  2. Phil HordJul 16, 2011
  3. Andreas SchwabJul 16, 2011
  4. Phil HordJul 17, 2011

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.