So I've been practicing git checkout --somefile.txt to checkout git files, in case I mess up, but my question would be how does Git know which file gets checked out from which commit?
i.e.: I write git
checkout -- index.html
git checkout -- some/path is equivalent to
git checkout HEAD -- some/path. As with most commands, Git will default to
HEAD here which is a reference to the currently checked out branch.
So if you’re on
git checkout -- some/path will check out the file from the