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

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

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Feb 23, 2007, 18:13 UTC
Message-ID
<Pine.LNX.4.63.0702231910270.22628@wbgn013.biozentrum.uni-wuerzburg.de>
In-Reply-To
<1172250283.5505.1176180417@webmail.messagingengine.com>
Hi,
On Sat, 24 Feb 2007, Sam Watkins wrote:
Show 15 quoted lines
> On Fri, 23 Feb 2007 17:40:02 +0100 (CET), "Johannes Schindelin"
> <Johannes.Schindelin@gmx.de> said:
> >
> > On Sat, 24 Feb 2007, Sam Watkins wrote:
> >
> > > it should merge the changes as if I'd run git-pull on the remote
> > > box, and handle conflicts in the same way.
> >
> > But that leaves conflicts in the working directory! You _have_ to
> > resolve them (or reset) before proceding.
> 
> I think it's ok for our application if the push+hook leaves conflicts in 
> the working directory, I just want to replicate the effect of running 
> git-pull remotely without actually having to go through ssh contortions 
> to achieve that.

I don't really see what you want to do there (and you don't want to tell me:-)). Nevertheless, it seems that Junio's script would help you. You cannot run a pull sanely when the working directory is dirty, and therefore the hook does not allow that.

BTW the easiest way to do what you apparently want is to push to a "remotely tracking" branch, i.e. a branch in the remotes/ hierarchy, and _then_ make an update hook which says "git merge remotes/<uploadbranch>".

Ciao, Dscho

Previous: Sam WatkinsNext: Junio C Hamano
Message 6 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.