Why Isn't There A Git Clone Specific Commit Option?

前端 未结 4 2022
一向
一向 2020-12-02 17:25

In light of a recent question on SO, I am wondering why isn\'t there an option in git clone such that the HEAD pointer of the newly created branch will point to

4条回答
  •  [愿得一人]
    2020-12-02 17:52

    Cloning a repo is a different operation than checkout. You don't "clone a specific commit". For convenience you can clone and then checkout a particular pre-existing branch at the same time, since that is what most people want. If that doesn't meet your needs (no branch for the particular SHA you want) just use or alias some form of

    git clone -n  && cd  && git checkout SHA
    

提交回复
热议问题