git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: demerphq <demerphq@gmail.com>
To: "Paul Vincent Craven" <paul@cravenfamily.com>
Cc: git@vger.kernel.org
Subject: Re: Question with git push
Date: Tue, 23 Dec 2008 18:37:47 +0100	[thread overview]
Message-ID: <9b18b3110812230937p3c53f778h508746a3df72610e@mail.gmail.com> (raw)
In-Reply-To: <5591393c0812230859n3b50b1f9k36153f40dd75ff57@mail.gmail.com>

2008/12/23 Paul Vincent Craven <paul@cravenfamily.com>:
> If I do a 'git push' to another repository, my changes are reverted
> the next time that repository is updated, unless I do a hard reset on
> the remote repository first.

Or just git checkout -f

> Of course, then I would lose my changes
> in the remote repository. What is the correct way of handling this?

I think the general practice is not to push to non-bare repositories
unless you and the owner of the repository can coordinate things. This
either means you push and then tell them, or they set up a
post-receive hook (and understand the consequences of doing so). Of
course often you are both of these people and coordination is easy.

The post-receive hook would go in .git/hooks and would effectively execute:

  git checkout -f

on push. However this also means that the working directory will be
unilaterally updated every time someone pushes. Not something you want
to do in a truely shared non-bare repo.
Yves


-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

      parent reply	other threads:[~2008-12-23 17:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-23 16:59 Question with git push Paul Vincent Craven
2008-12-23 17:35 ` Peter Harris
2008-12-23 17:37 ` demerphq [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9b18b3110812230937p3c53f778h508746a3df72610e@mail.gmail.com \
    --to=demerphq@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=paul@cravenfamily.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).