All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
To: Pedro Sa Costa <psdc1978@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: git push in a git-init without --bare option?
Date: Sun, 26 Jun 2011 20:17:29 +0200	[thread overview]
Message-ID: <vpqliwoa24m.fsf@bauges.imag.fr> (raw)
In-Reply-To: <201106261142.28142.psdc1978@gmail.com> (Pedro Sa Costa's message of "Sun, 26 Jun 2011 11:42:28 +0100")

Pedro Sa Costa <psdc1978@gmail.com> writes:

> - I see that in git, I can't do git-push to a repository that wasn't created 
> with git-init --bare. Why?
>
> - But doing git-pull and git-checkout to the same repository is possible. I'm 
> really confused. Any help?

git pull involves a merge, and merge may involve conflicts, and
conflicts involve a user fixing them ... So, doing a "git pull" to merge
in remote changes is OK, but a "git push" cannot merge changes remotely,
hence the asymetry.

Git could just send the commits, without updating the working tree, but
that would be terrible for the user. Let's say the user has no local
change before the push. His checkout points to the tip of a branch
(information stored in HEAD), so the tree matches the old HEAD. Updating
the branch means changing the commit pointed to by HEAD, hence after a
push, the tree does not match the HEAD anymore (which means the next
commit will seem to revert the pushed history). This is to prevent this
situation that Git refuses to push to non-bare repos.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

  parent reply	other threads:[~2011-06-26 18:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-26 10:42 git push in a git-init without --bare option? Pedro Sa Costa
2011-06-26 11:35 ` Elia Pinto
2011-06-26 18:17 ` Matthieu Moy [this message]
2011-06-26 21:21   ` Pedro Sa Costa
2011-06-26 22:30     ` Christof Krüger

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=vpqliwoa24m.fsf@bauges.imag.fr \
    --to=matthieu.moy@grenoble-inp.fr \
    --cc=git@vger.kernel.org \
    --cc=psdc1978@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.