What is the difference between “git branch” and “git checkout -b”?

后端 未结 7 1729
礼貌的吻别
礼貌的吻别 2020-11-29 16:18

I used git checkout -b to create a new branch. I think that git branch does the same thing. How do these two commands differ, if they differ at all

7条回答
  •  我在风中等你
    2020-11-29 16:26

    There is also another flag to mention, which is relative to these..

    git checkout -B BRANCH_NAME
    

    This is a very useful command that i've been using recently. This command checks out the branch you specify, and resets the branch based on the source branch.

提交回复
热议问题