What do git checkouts really mean?

后端 未结 3 1031
执笔经年
执笔经年 2020-12-02 07:25

What are checkouts in git?

I know once you do checkout to a particular branch, the HEAD points to that branch. But what does

3条回答
  •  温柔的废话
    2020-12-02 07:54

    "To check out" means that you take any given commit from the repository and re-create the state of the associated file and directory tree in the working directory.

    When you check out a commit that is not a branch head (e.g. git checkout HEAD~2), you are on a so-called detached head. You can create commits here, but once you switch to a different branch, those commits will not be recoverable by a branch name and might even get removed by the garbage collector after some time.

提交回复
热议问题