git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git-add and index
@ 2009-03-03  7:20 bill lam
  2009-03-03  8:00 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: bill lam @ 2009-03-03  7:20 UTC (permalink / raw)
  To: git

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?
2. How to checkout the changes as recorded in index from git-add that
   not yet commit to the working tree?

Thanks!

-- 
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
唐詩179 王維  奉和聖製從蓬萊向興慶閣道中留春雨中春望之作應制
    渭水自縈秦塞曲  黃山舊遶漢宮斜  鑾輿迥出千門柳  閣道迴看上苑花
    雲裡帝城雙鳳闕  雨中春樹萬人家  為乘陽氣行時令  不是宸遊玩物華

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: git-add and index
  2009-03-03  7:20 git-add and index bill lam
@ 2009-03-03  8:00 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2009-03-03  8:00 UTC (permalink / raw)
  To: bill lam; +Cc: git

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-03-03  8:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-03  7:20 git-add and index bill lam
2009-03-03  8:00 ` Junio C Hamano

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).