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

Re: Commit changes to remote repository

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 17, 2012, 00:12 UTC
Message-ID
<7vpqejtcep.fsf@alter.siamese.dyndns.org>
In-Reply-To
<vpqboq6fjfy.fsf@bauges.imag.fr>
Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
Show 10 quoted lines
> Carlos Martín Nieto <cmn@elego.de> writes:
>
>> You're trying to push to a non-bare repository and change the
>> currently active branch, which can cause problems, so git isn't
>> letting you. There's an explanation of bare and non-bare at
>> http://bare-vs-nonbare.gitrecipes.de/ but the short and sweet is that
>> you should init the repo you want to use as the central point with
>> --bare and do modifications locally and then push there.
>
> An alternative is to push to a temporary, non-checked-out branch.

Or more generally, treat such a push as if you are pulling in the opposite direction. So in this example,

Show 7 quoted lines
> I sometimes do
>
>   laptop$ git push desktop HEAD:incomming
>
> and then
>
>   desktop$ git merge incomming

you pretend as if you are running "git pull" on your desktop in order to integrate the work done on your laptop. If you did

    desktop$ git pull laptop

you would store where the branches on the laptop are in the remote tracking branches for "laptop" remote in your desktop's repository.

So a good way to simulate that would be:
    laptop$ git push desktop master:refs/remotes/laptop/master
and then run:
    desktop$ git merge laptop/master
> The push does not disturb the worktree on the desktop, and the merge is
> done manually on the receiving machine.
Previous: Matthieu Moy
Message 4 of 4 in “Commit changes to remote repository”
  1. rupertyJan 13, 2012
  2. Carlos Martín NietoJan 14, 2012
  3. Matthieu MoyJan 14, 2012
  4. Junio C HamanoJan 17, 2012

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.