0

有人可以解释这里发生了什么吗?为什么有两个主要分支,一个名为“origin/main”,另一个名为“main”

做了一个别名图

DRB@SamiUllah MINGW64 /d/30days_python/myscrapping (main)
$ alias graph="git log --all --decorate --oneline --graph

图表显示我有两个分支。所以,我决定将主分支与 origin/main 合并

DRB@SamiUllah MINGW64 /d/30days_python/myscrapping (main)
$ graph
* 593f35d (HEAD -> main) Reorganized files of this repo
* 92fbed4 (origin/main) First commit from local repo
* eaf216d Initial commit

在结帐时,它说: 您处于“分离 HEAD”状态。

DRB@SamiUllah MINGW64 /d/30days_python/myscrapping (main)
$ git checkout origin/main
Note: switching to 'origin/main'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 92fbed4 First commit from local repo

DRB@SamiUllah MINGW64 /d/30days_python/myscrapping ((92fbed4...))
$ git checkout main
Previous HEAD position was 92fbed4 First commit from local repo
Switched to branch 'main'
4

1 回答 1

1

origin是一个远程存储库。

git remote -v将列出所有远程存储库。

远程存储库有名称。经常为远程存储库选择“来源”。

您会看到两个主要分支,因为 - 远程存储库和本地存储库具有相同的分支

于 2021-01-11T19:43:16.260 回答