Re: git push in a git-init without --bare option?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Pedro Sa Costa <psdc1978@xxxxxxxxx> 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/
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]