git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Kyle Rose <krose@krose.org>
Cc: git mailing list <git@vger.kernel.org>
Subject: Re: new to git
Date: Mon, 27 Aug 2007 16:11:31 -0400	[thread overview]
Message-ID: <20070827201131.GK3118@fieldses.org> (raw)
In-Reply-To: <46D32973.8030104@krose.org>

On Mon, Aug 27, 2007 at 03:43:47PM -0400, Kyle Rose wrote:
> I've been playing with it for a few weeks and generally understand what
> is going on, but I do have a few usage questions that I couldn't find
> answered in the docs:

I think I tried to cover most of this in the user-manual
(http://www.kernel.org/pub/software/scm/git/docs/user-manual.html has
the latest version, or it's in Documentation/) but some of it may be
harder to find than it should be.

> (1) Let's say I:
> 
> git clone something
> git branch foo
> git checkout foo
> <make some changes>
> git commit -a
> git checkout master
> git pull . foo
> git push
> git pull
> 
> what is actually happening?  The pull appears to do something (i.e., I get:
> 
> * refs/remotes/origin/master: fast forward to branch 'master' of
> /home/krose/git-repository/baz/
>   old..new: 7cf088c..d344f98

Git caches the value of the remote's "master" in
refs/remotes/origin/master.  That's the thing that's getting updated;
you can actually

	cat .git/refs/remotes/origin/master

before and after you'll see that it got updated from 7cf088c to d344498.

I think newer versions of git actually update that "remote-tracking
branch head" on the push as well, which would prevent you from getting
the message since by the time of the pull that thing will already have
been updated.

> (3) I notice I can't reset --hard a single file.  So, if I want to
> revert a single file to some revision, blowing away my changes, what is
> the accepted way of doing this?

	git checkout some_revision path/to/filename

> Is there a way to do the equivalent of
> a p4 print foo@some_revision?

I don't know p4, but maybe you're looking for

	git show some_revision:foo

> (4) I'm still not clear on when a dst should and should not be used in a
> refspec.  It appears that one can only do non-fast forward updates to
> the branch that is checked out (which makes sense, since you may need to
> resolve), but other than that, what is the difference between
> 
> git checkout foo
> git pull . master
> 
> and
> 
> git checkout master
> git push . master:foo

The latter should forcibly reset the branch head "foo" to point at the
same commit as "master".  The former tries to do a merge between the
two.

In the case where master is a descendant of foo (so there's no commits
in foo that isn't already in master), the two should do the same thing.

> (5) Are there any tools for managing some of the metadata (e.g., the
> origin URL) or is it expected that one edit it directly?

Maybe you want "man git-remote"?  Or see "git-config" for more general
configuration.

But editing .git/config file directly is often simplest, and won't cause
any problem.

--b.

  reply	other threads:[~2007-08-27 20:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-27 19:43 new to git Kyle Rose
2007-08-27 20:11 ` J. Bruce Fields [this message]
2007-08-27 20:22 ` Andreas Ericsson
2007-08-27 20:36   ` Kyle Rose
2007-08-27 20:39   ` Junio C Hamano
2007-08-27 21:14     ` Andreas Ericsson
2007-09-05  5:56 ` Jan Hudec
2007-09-05  6:54 ` Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2011-04-08 19:43 New " Marco Maggesi
2011-04-08 20:10 ` Jeff King
2011-04-09 19:15   ` Marco Maggesi
2011-04-09 19:35     ` Dmitry Potapov
2011-04-09 22:41     ` Matthieu Moy

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20070827201131.GK3118@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=git@vger.kernel.org \
    --cc=krose@krose.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).