logoalt Hacker News

saghmyesterday at 3:13 PM1 replyview on HN

> In all 3 cases, the command is pointed at a commit and the behavior is the same

    echo "something" >> foo.txt
    git checkout foo.txt
What's the name of the branch this is pointed at? If I have to run another git command to find out, then it's not "pointed" at it.

Replies

webstrandyesterday at 3:46 PM

If you don't provide it a <tree-ish> it reads from the index (staged files). So you're right its not really pointed anywhere, since the index isn't a ref.

show 1 reply