Subject: Re: git-push hook to update remote working copy safely

From: "Sam Watkins" <[email-masked]>
Date: Sat, 24 Feb 2007 03:35:00 +1100

On Fri, 23 Feb 2007 03:00:09 -0800, "Junio C Hamano" <[email-masked]>
said:
> "Sam Watkins" <[email-masked]> writes:
> 
> > I'm looking for a command that will update the remote working copy after
> > a "git push", without damaging any changes that may have been made to
> > the working copy.
> 
> Define "without damaging".  If there are changes to paths that
> are modified by the pushed commit since the current HEAD, what
> should your "update the remote working copy" procedure would
> do?

hi Junio,

it should merge the changes as if I'd run git-pull on the remote box,
and handle conflicts in the same way.

If possible I want to get exactly the effect of having run on box B
"git-pull A", by running a command like "git-push B" on box A.  I think
maybe that's not possible without commiting all changes to the working
copy on B first, but for our app it's fine to do that it's meant to do
that automatically and frequently anyway.
so I will just do that then run checkout -f from the hook.

I don't understand git very well yet but that will work I think.  I
thought "push" would be symmetrical to "pull" more or less, maybe it is
symmetrical to "fetch" ?

thank-you for your help, I am reading some more of the git manual
because I understand only some of your reply and very little about git
yet!

The app "arcs" we are writing, it is peer to peer, not necessarily using
a central repository, it commits pulls and pushes all changes made to
working copies automatically or when asked to.  currently I'm
implementing push as a remote pull because of this problem, but that
can't connect back through firewalls and suchlike.

Sam