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

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

 



Huh?  What does he mean by that?

I have the following in my .git/config file:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = somehost:path/to/repo
[branch "master"]
	remote = origin
	merge = refs/heads/master
[branch "wpd"]
	remote = origin
	merge = refs/heads/wpd

I have been working on my "wpd" branch on a couple of different
machines and have been happily committing, pushing, and pulling from
my "origin" host.  Recently, however, somebody committed a change on
the "master" branch.  Now, when I do a "git push", I get the following

$ git push
Counting objects: 11, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 715 bytes, done.
Total 6 (delta 4), reused 0 (delta 0)
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.

The last time I encountered this, I did a "get checkout master; git
merge origin/master; git checkout wpd; git push" and that worked.  I
happen to know that master is a direct descendent of origin/master and
that, if I do this again, I will (once again) do a fast-forward merge
to bring master up to origin/master.

This may have been fixed in a more recent git (I'm using git 1.7.2.5
on a Debian 6 box and 1.7.4.1 on an RHEL 5 box).

There has got to be an easier way to fix this than checking out the
master branch, performing the fast-forward merge, and then switching
back to my working branch.

One way would be if there were some way to do a fast-forward merge on
a branch without actually checking out that branch.  Hence my
question.

Another way would be to remove the "master" branch from my config file.

Or perhaps I set up something wrong.

--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]