Hacker News new | ask | show | jobs
by skydhash 66 days ago
> I still don't understand why `checkout` is both for changing branches and clearing uncommitted changes.

Because `checkout` is for getting the working directory to the state of a specific revision. Which both means switching branches (which are just pointer to revisions) and clearing changes (and get back to the starting revision). In both cases, you "check out" the version of the file at a specific commit or HEAD.