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

Re: How to do a fast-forward merge without a checkout?

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Jul 18, 2011, 15:08 UTC
Message-ID
<4E244C75.6060407@viscovery.net>
In-Reply-To
<CAF_dkJCvtVqoDmRXMy23ZnZL6iUAVX0nNA9Ev6e4zvBp9mfTpg@mail.gmail.com>
Am 7/18/2011 16:18, schrieb Patrick Doyle:
> $ git push
...
> To somehost:path/to/repo
>    e1004df..bad8767  wpd -> wpd
>  ! [rejected]        master -> master (non-fast-forward)

[Context: Patrick works on the topic branch, but can't push it anymore because the unrelated branch master was moved forward by someone else.]

After the obligatory 'git fetch', there are at least two ways to do this:
(1) The quick and unsafe way:
    $ git branch -f master origin/master
(2) The safer way:
    $ git push . origin/master:master

The second command is safer because it checks that origin/master is indeed a direct descendent of master.

-- Hannes
Previous: Patrick DoyleNext: Patrick Doyle
Message 2 of 6 in “How to do a fast-forward merge without a checkout?”
  1. Patrick DoyleJul 18, 2011
  2. Johannes SixtJul 18, 2011
  3. Patrick DoyleJul 18, 2011
  4. knittlJul 18, 2011
  5. Patrick DoyleJul 18, 2011
  6. knittlJul 18, 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.