我创建了一个新的本地存储库(使用git init,然后添加并提交一些文件)。后来我添加了一个远程存储库:
$git remote add br /home/user/work/git/bare/
我可以通过命令git remote -v看到它 git fetch br也是成功的
当我切换到此回购时,它会给出以下消息:
$ git checkout br/master
Note: checking out 'br/master'.
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 performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
HEAD is now at a155c68... Added Makefile.in`
我不明白上面的文字?什么是'独立的HEAD'状态?
添加:
$ git branch
* (no branch)
master
$
我不在分支,怎么/为什么?
答案 0 :(得分:1)
您签出了远程分支指向的提交(您可以使用<item name="actionOverflowButtonStyle">@style/OverflowMenuButton</item>
列出它们)。如果它没有被任何本地分支指向,则会导致头部分离。您应该将git branch -r
设置为本地br/master
的上游。
master
然后,您可以使用git checkout master
git branch -u br/master
和master
同步本地和远程git push
分支。