Re: Git-Automerge
- From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Date
- Apr 4, 2010, 16:53 UTC
- Message-ID
- <vpqr5mv40s2.fsf@bauges.imag.fr>
- In-Reply-To
- <w2j1f05046e1004040947k3b812063ndbc2f8da3496effb@mail.gmail.com>
Nico Schümann <nico.schuemann@googlemail.com> writes:
> But the changes do not appear on the master server. I have to type > > # git reset --hard or > # git checkout -f
You pushed to a checked-out branch. You shouldn't do that, and recent Git prevent you from doing it.
The reason Git cannot do the merge automatically is that a merge can go wrong, and may require a human interaction to resolve conflicts. Hence, "push" never does a merge, only "pull" (and obviously local merge) will do.
You can do
client-machine$ git push URL-OF-SERVER HEAD:tmp
to push your current HEAD to a branch named "tmp" on the server, and then
server-machine$ git merge tmp
to merge the changes in the current branch of the server. Another option is to have a bare repository reachable from both machines, and both machine would push/pull to this repository (just like you'd do with a centralized version control system).
-- Matthieu Moy http://www-verimag.imag.fr/~moy/