Why does `git checkout <branch> <file>` stage the change?
问题 If I start from a clean working tree and run git checkout <branch> <file> , where <branch> has a different version of this file, I end up with a staged rather than an unstaged change. What's the reason for this? Is this just for consistency with other commands like git mv , which you would expect to stage changes? Is it for convenience when using git checkout to resolve merge conflicts? Or is there some other rationale? It seems mildly odd to me since just using git checkout <branch> <file>