git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Sam Watkins <swatkins@fastmail.fm>
Date
Feb 23, 2007, 16:35 UTC
Message-ID
<1172248500.32514.1176151445@webmail.messagingengine.com>
In-Reply-To
<7v649t5ebq.fsf@assigned-by-dhcp.cox.net>

On Fri, 23 Feb 2007 03:00:09 -0800, "Junio C Hamano" <junkio@cox.net> said:

Show 10 quoted lines
> "Sam Watkins" <swatkins@fastmail.fm> 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
Previous: Junio C HamanoNext: Johannes Schindelin
Message 3 of 7 in “git-push hook to update remote working copy safely”
  1. Sam WatkinsFeb 23, 2007
  2. Junio C HamanoFeb 23, 2007
  3. Sam WatkinsFeb 23, 2007
  4. Johannes SchindelinFeb 23, 2007
  5. Sam WatkinsFeb 23, 2007
  6. Johannes SchindelinFeb 23, 2007
  7. Junio C HamanoFeb 23, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.