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
PDPatrick Doyle <wpdster@gmail.com>
Date
Jul 18, 2011, 15:25 UTC
Message-ID
<CAF_dkJBWzOR76RUrB9P2UkLfR8_vhU-ExGROu73dAg=JJN-p_Q@mail.gmail.com>
In-Reply-To
<4E244C75.6060407@viscovery.net>
On Mon, Jul 18, 2011 at 11:08 AM, Johannes Sixt <j.sixt@viscovery.net> wrote:
Show 22 quoted lines
> 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.

I like it! (#2) It's obscure as all get-out, as UNIX commands were intended to be, does the job you need it to do in a manner that is intuitive, provided you understand what it's doing, and if you miss the dot (perhaps, hypothetically speaking of course, because you thought it was a dust spec on your screen when you tried out the command), you get a very obscure error message (errr, hypothetically speaking of course).

Seriously... Thanks for the quick answers. I'll tuck #2 into my bag o' tricks. In the mean time, I need to decide whether I really care about my master branch or not. I do care about origin/master, but I do all my work on wpd and merge in changes from origin/master at random points in time.

Thanks again.
--wpd
Previous: Johannes SixtNext: knittl
Message 3 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.