All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: bill lam <cbill.lam@gmail.com>
Cc: git <git@vger.kernel.org>
Subject: Re: git-add and index
Date: Tue, 03 Mar 2009 00:00:52 -0800	[thread overview]
Message-ID: <7vprgzf32j.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <20090303072008.GB7478@b2j> (bill lam's message of "Tue, 3 Mar 2009 15:20:08 +0800")

bill lam <cbill.lam@gmail.com> writes:

> I have 2 questions related to index
> 1. Is it safe to just git-add (without commit) for local changes made
>    before checkout or switch to another branch?

As long as the other branch does not touch the same path, it should be kept
in the index during the branch switching.

"Is it safe" and "does it work like this" questions are easier to answer by
a bit of experimenting in a toy repository these days ;-).

> 2. How to checkout the changes as recorded in index from git-add that
>    not yet commit to the working tree?

"git checkout -- path"?  If you do not have a revision that can be referred
to as path (iow the file you are trying to check out of the index is not
e.g. "master"), you do not have to say -- and just "git checkout path"
should suffice.

      reply	other threads:[~2009-03-03  8:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-03  7:20 git-add and index bill lam
2009-03-03  8:00 ` Junio C Hamano [this message]

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=7vprgzf32j.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=cbill.lam@gmail.com \
    --cc=git@vger.kernel.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.
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.