Re: Resetting working files

4 messages, 3 authors, 2016-06-15 · open the first message on its own page

Re: Resetting working files

From: Aaron Gray <hidden>
Date: 2016-06-15 22:46:53

2009/5/31 bill lam [off-list ref]
On Sun, 31 May 2009, Peter Baumann wrote:
quoted
      echo modified >> a.txt
      git add a.txt
      git checkout -- a.txt           (1)

      git checkout HEAD -- a.txt      (2)


(1) This will do nothing to your file 'a.txt' in your workdir because
    the index and the workdir are identical

(2) This will reset your file to the state before you run that bogus
    echo modified >> a.txt   comand
I still do not understand what index is.
1. is index an replica of the committed tree
2. is index only transient in that its content will be reset once
  committed?
3. or other ?
I think index is HEAD or a revision hash. Am I correct ?

Aaron

Re: Resetting working files

From: Nicolas Sebrecht <hidden>
Date: 2016-06-15 22:46:53

The 31/05/09, Aaron Gray wrote:
quoted
I still do not understand what index is.
1. is index an replica of the committed tree
2. is index only transient in that its content will be reset once
  committed?
3. or other ?
I think index is HEAD or a revision hash. Am I correct ?
HEAD is a reference to a branch name:
$ cat .git/HEAD
ref: refs/heads/master
$

The branch name is a reference to a commit:
$ cat .git/refs/heads/master
a80aad7b85fc560451e07792d64ab6cb15a39914
$

The index is what will be committed by 'git commit'.

-- 
Nicolas Sebrecht

Re: Resetting working files

From: Aaron Gray <hidden>
Date: 2016-06-15 22:46:53

The 31/05/09, Aaron Gray wrote:
quoted
quoted
I still do not understand what index is.
1. is index an replica of the committed tree
2. is index only transient in that its content will be reset once
committed?
3. or other ?
I think index is HEAD or a revision hash. Am I correct ?
HEAD is a reference to a branch name:
$ cat .git/HEAD
ref: refs/heads/master
$

The branch name is a reference to a commit:
$ cat .git/refs/heads/master
a80aad7b85fc560451e07792d64ab6cb15a39914
$

The index is what will be committed by 'git commit'.
Obviously alot more to learn about GIT, hopefully the O'Reilly book will 
clue me up as I am still getting problems with using GIT properly.

Thanks Nicolas,

Aaron

Re: Resetting working files

From: Alex Riesen <hidden>
Date: 2016-06-15 22:46:53

2009/5/31 Nicolas Sebrecht [off-list ref]:
The 31/05/09, Aaron Gray wrote:
quoted
I think index is HEAD or a revision hash. Am I correct ?
HEAD is a reference to a branch name:
Not really. Try "git checkout HEAD^" and run cat .git/HEAD

It is more a pointer to a commit. The pointers to a commit
in git are allowed to be indirect by referencing other pointers.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help