Git 当我键入';吉特分行';什么也没发生
到目前为止,我已经克隆了一个空的git repo,并用“git checkout-b branchname”创建了一个新分支。我的理解是,现在输入'git branch'应该会给我一些输出,比如Git 当我键入';吉特分行';什么也没发生,git,Git,到目前为止,我已经克隆了一个空的git repo,并用“git checkout-b branchname”创建了一个新分支。我的理解是,现在输入'git branch'应该会给我一些输出,比如 * mybranch master 相反,我没有得到任何输出。 然而,输入“git状态”仍然告诉我 # On branch branchname # # Initial commit # nothing to commit (create/copy files and use "git add"
* mybranch
master
相反,我没有得到任何输出。
然而,输入“git状态”仍然告诉我
# On branch branchname
#
# Initial commit
#
nothing to commit (create/copy files and use "git add" to track)
那么为什么我没有从“git branch”获得任何输出呢?我不知道有任何
git-b
命令。你是说git checkout-b branchname
(它创建分支并切换到它)
您可以通过git branchname
创建一个分支
此外,您还可以使用git branch-a
,它还列出了远程分支
编辑:
顺便说一句如果没有提交(只看到了“#初始提交”),则没有任何分支(甚至没有主分支)。您必须先进行第一次提交。修复了输入错误。git checkout-b branchname就是我所做的。