As I understand when I run git reset
without any parameters and paths it defaults to --mixed
which git manual describes as:
Resets the index but not the working tree (i.e., the changed files are preserved but not marked for commit) and reports what has not been updated.
I'm wondering what does it reset it to? I assume that it reads some tree into index file using git read-tree
, but where does it find that tree? Some other options explain that the tree is found in the HEAD
file which points to a commit or branch and hence a tree hash can be resolved.
However, I've used git read-tree aa23
to put the tree into index and currently my HEAD
file contains the following:
ref: refs/heads/master
But there's no branch created yet. The tree contains two files:
$ git ls-files -s
100644 a1deaae8f9ac984a5bfd0e8eecfbafaf4a90a3d0 0 f1.txt
100644 9b96e21cb748285ebec53daec4afb2bdcb9a360a 0 f2.txt
And when I run the git reset
I get no errors, git status
reports no changes and git ls-files -s
reports no files. So what did the index was reset to?