Thread (1 message) 1 message, 1 author, 2016-06-15
  • (off-list ancestor, not in this archive)
  • Re: git-add and index · Junio C Hamano <hidden> · 2016-06-15

Re: git-add and index

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:46:19

bill lam [off-list ref] 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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help