One doubt about Git and pushing to the origin

0 views
Skip to first unread message

Marze

unread,
Dec 9, 2007, 1:53:28 PM12/9/07
to PeepCode
Hey! ho!

I've been learning Git with the screencast (so great) but there is one
thing that really struggles me.
I set up the origin repository as commented in the screencast and then
I push some changes, then I delete my local copy and clone again from
the origin and everything is OK

But then I log into the server and I look into the origin copy, but my
changes are not applied there.

I do the same pushing a branch to the origin and logging into the
server, then in the server I checkout to the pushed branch and then to
the master, and the changes are applied!

I can't understand this behaviour since Subversion just mirrors
everything

I also saw so kind of command

git push --mirror

but seems that it's not working or it's in dev

anyone knows why git does this?

thanx

topfunky

unread,
Dec 9, 2007, 3:06:21 PM12/9/07
to PeepCode
On Dec 9, 10:53 am, Marze <superage...@gmail.com> wrote:
> I set up the origin repository as commented in the screencast and then
> I push some changes, then I delete my local copy and clone again from
> the origin and everything is OK
>
> But then I log into the server and I look into the origin copy, but my
> changes are not applied there.

This is a great observation and can be confusing. I've experienced
this when working from backups of my repositories.

Git keeps all branches, tags, and objects in a database inside
the .git directory. That will always be up to date when you push to
it, but it won't necessarily update the working directory on the
server (i.e. the non-hidden directories and files you see inside the
repository).

The easiest way is just to clone again, as you noticed. You could also
manually merge the master branch on the server with its own database
(try "git merge master").

There are more complicated ways of keeping it in sync, but cloning is
the easiest way.

Geoffrey Grosenbach
http://peepcode.com

Marze

unread,
Dec 9, 2007, 3:23:15 PM12/9/07
to PeepCode
> The easiest way is just to clone again, as you noticed. You could also
> manually merge the master branch on the server with its own database
> (try "git merge master").

So, as i understand, i will have to manually log into the server and
do it.
There's no way to sync both with push? I saw some kind of "git push --
mirror" but it's not working on my install.

Wayne E. Seguin

unread,
Dec 9, 2007, 10:59:13 PM12/9/07
to peep...@googlegroups.com
On Dec 9, 2007 3:23 PM, Marze <super...@gmail.com> wrote:
So, as i understand, i will have to manually log into the server and
do it.
There's no way to sync both with push? I saw some kind of "git push --
mirror" but it's not working on my install.

Couldn't you just log into the server and type "git rebase" to view changes on server's git repo?

  ~Wayne

topfunky

unread,
Jan 28, 2008, 10:54:11 AM1/28/08
to PeepCode
On Dec 9 2007, 12:23 pm, Marze <superage...@gmail.com> wrote:
> There's no way to sync both with push? I saw some kind of "gitpush --
> mirror" but it's not working on my install.

Bruce Williams linked to a script that will do what you are looking
for:

http://utsl.gen.nz/git/post-update

Mentioned here:

http://codefluency.com/articles/2008/01/27/welcome-back-codefluency/

Geoffrey Grosenbach
http://peepcode.com
Reply all
Reply to author
Forward
0 new messages