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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 18, 2011 at 12:08 PM, knittl <knittl89@xxxxxxxxxxxxxx> wrote:
> On Mon, Jul 18, 2011 at 4:18 PM, Patrick Doyle <wpdster@xxxxxxxxx> wrote:
>> […]
>>
>> $ git push
>> […]
>> To somehost:path/to/repo
>>   e1004df..bad8767  wpd -> wpd
>>  ! [rejected]        master -> master (non-fast-forward)
>> error: failed to push some refs to 'somehost:path/to/repo'
>> To prevent you from losing history, non-fast-forward updates were rejected
>> Merge the remote changes (e.g. 'git pull') before pushing again.  See the
>> 'Note about fast-forwards' section of 'git push --help' for details.
>>
>
> another way to avoid pushing the master branch is to explicitely name
> the branch to push (wpd):
>
>    $ git push origin wpd
>
Thanks... I thought of that, but being basically lazy and not wanting
to have to type all of those extra characters every time I did a "git
push", I wanted to figure out a better way.

Seth Milliken posted a great explanation and alternative solution in a
comment to a blog post I found at
http://ken-blog.krugler.org/2010/02/25/git-failed-to-push-some-refs-the-multiple-branch-variant/.
 He suggested doing:

$ git config remote.origin.push HEAD

So that "git push" would default to only pushing the current branch.
I like that approach to my underlying problem as well.

But I stand in awe of Hanne's solution (#2) for it's brevity, the fact
that it does _exactly_ what I was asking about, and that the
capability is already baked into git.

--wpd
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]