简体   繁体   中英

GIT : All new branches come under previous branch

我是git的新手,所以这是我的仓库https://github.com/nayak94/nayak-kernel正在分支0.1上工作,现在想尝试一些新功能,因此使用“ git checkout -b 0.2”将分支0.2做成了现在它显示https://github.com/nayak94/nayak-kernel/branches 0.2与0.1合并了有人可以解释它是如何工作的,通读许多教程无法理解,如何在不合并的情况下创建新分支旧的吗?

When you create a new branch, git forks the new branch from the current branch you are on, in your case, it is 0.1 .

If you want to create branch from master , you should switch to master and create branch from there.

  1. git checkout master
  2. git checkout -b 0.2

After that you have two branches ( 0.1 and 0.2 ) created from master branch.

As a side note: git checkout -b branch_name creates a branch and switches to that branch. Meanwhile git branch branch_name creates a branch but stays on the current branch. If you have used the second option, you shouldn't have had this problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM