Git how to checkout a commit of a branch

后端 未结 3 1026
花落未央
花落未央 2021-02-02 06:10

How can I check out a commit version of a branch in git?

For example, my branch, Dev, has a commit ad4f43af43e. How can I check o

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-02 06:53

    If you're looking to branch out from a specific commit of a branch, first be sure you are in the branch,

    git checkout dev
    

    Now I want to checkout a specific commit 123654 from the dev branch to a new branch while keeping the head on main branch.

    git checkout -b new-branch 123654
    

提交回复
热议问题