git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Glanzmann <thomas@glanzmann.de>
To: Robert Smith <wolf1boy79@yahoo.com>
Cc: git@vger.kernel.org
Subject: Re: Newbie using git -- need a little help
Date: Sun, 17 Jun 2007 21:17:45 +0200	[thread overview]
Message-ID: <20070617191745.GD21291@cip.informatik.uni-erlangen.de> (raw)
In-Reply-To: <42118.74778.qm@web57410.mail.re1.yahoo.com>

Hello Robert,

> I'm not sure what I'm doing wrong.  I see the change once the tree is
> pushed to the server (from the desktop), but it is undone
> automatically with a git commit -a.

When you push to your server, the repository is updated (that is the
thing that is in .git) but your working tree isn't.

So when you push to a repository that also has a working tree attached
to it, you have to do a "git checkout" on the working tree. Or pull from
the repository and not push to it.

For a long time I did the same thing you did. I had a repository with a
working tree that I pushed into. I did it with bitkeeper and I did with
git. However these days I dropped that idea because it is not worth the
trouble (and it wasn't from the beginning) I just got used to it and did
not thought about it.

What I do now is the following:

On my laptop:

        mkdir dir
        git init
        # add some files
        git add .
        git commit 

Than I publish my project to the server without giving the repository at
the server a working directory attached to it. A working directory is
where you can edit files and commit changes locally, just in case I
didn't introduce the term yet.

        # This creates the repository _without_ the working tree on the server.
        ssh 131.188.30.102 git --git-dir=/home/cip/adm/sithglan/work/repositories/private/astro.git init-db

        # This adds the remote origin to the config so that I don't have to
        # type in the long repository path each time I am going to push or pull
        # something.
        git remote add origin 131.188.30.102:/home/cip/adm/sithglan/work/repositories/private/astro.git

        # Now I publish my stuff to the central repository. You need at least
        # one commit in order to be able to do that.
        git push origin master:master


        # I add a few lines to my config so that when I type in "git pull" it
        #fetches the stuff and merges it with my local repositories master branch.

        "vim .git/config" and add the following lines:

[branch "master"]
        remote = origin
        merge = refs/heads/master
EOF

        # Now I can fetch back to see if everything works
        git pull

Now I am fine the infrastructure is all set up. The next time I am going
to access the project from a different machine I simply do:

        git pull 131.188.30.102:/home/cip/adm/sithglan/work/repositories/private/astro.git

And that's it. The origin and where it is going to merge stuff is set
automatically up by git. Note: I use ssh (attached to a ssh-agent so that I
don't have to passwords all the time I am doing a push or pull). I hope that
helps you and didn't miss your original question. I just fly over your e-Mail
and picked a few keywords to comment on.

        Thomas

  reply	other threads:[~2007-06-17 19:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-17 18:55 Newbie using git -- need a little help Robert Smith
2007-06-17 19:17 ` Thomas Glanzmann [this message]
2007-06-19  4:10 ` J. Bruce Fields
  -- strict thread matches above, loose matches on Subject: below --
2007-06-17 20:06 Robert Smith
2007-06-17 20:30 ` Thomas Glanzmann

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=20070617191745.GD21291@cip.informatik.uni-erlangen.de \
    --to=thomas@glanzmann.de \
    --cc=git@vger.kernel.org \
    --cc=wolf1boy79@yahoo.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).