Re: How to do a fast-forward merge without a checkout?
- From
- Patrick 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