git :克隆远程存储库,签出分支,提交更改...如何更新远程分支?
这就是遥控器的样子。
--C0--------------C4-- (master)
\
--C1-C2-C3-- (lite_main)
我采取的操作:
- 克隆远程存储库
- ,签出 lite_main
- 进行了一些更改并提交了
来自 git reflog
的结果:
27f07f4 HEAD@{0}: commit: ADDING ICON FILES TO FILE SYSTEM 445ef4b HEAD@{1}: checkout: moving from master to lite_main f9cccc0 HEAD@{2}: clone: from [email protected]:username/somerepo.git
gitbranch -a
的结果,尝试显示跟踪的分支:
* lite_main master remotes/origin/HEAD -> origin/master remotes/origin/lite_main remotes/origin/master
(我真的不知道如何阅读这个购买,我猜唯一跟踪的分支是我的本地起源/主被跟踪到远程/起源/头部......是这样吗?)
现在我的本地仓库看起来像这样:
--C0--------------C4-- (master)
\
--C1-C2-C3-C5-- (lite_main)
我该怎么做我的遥控器看起来和我本地的一样吗?将 lite_main 推送到 origin 可以吗?
This is what the remote looks like.
--C0--------------C4-- (master)
\
--C1-C2-C3-- (lite_main)
Actions I took:
- cloned the remote repo
- checked out lite_main
- made some changes and committed them
Results from git reflog
:
27f07f4 HEAD@{0}: commit: ADDING ICON FILES TO FILE SYSTEM 445ef4b HEAD@{1}: checkout: moving from master to lite_main f9cccc0 HEAD@{2}: clone: from [email protected]:username/somerepo.git
Results of git branch -a
to try to show the tracked branches:
* lite_main master remotes/origin/HEAD -> origin/master remotes/origin/lite_main remotes/origin/master
(I don't really know how to read this buy I'm guessing the only traced branch is my local origin/master is tracked to the remotes/origin/HEAD...is that right?)
Now my local repo looks like this:
--C0--------------C4-- (master)
\
--C1-C2-C3-C5-- (lite_main)
How do I make my remote look like what I have locally? Will pushing lite_main to origin do it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您所要做的就是:
此外,如果您想在创建分支时跟踪远程,您可以运行命令(创建分支时)
git checkout --track -b;/<跟踪分支>
示例
git checkout --track -b foo remote/foo
All you have to do is:
Additionally, if you want to track the remote when creating the branch you can run the command (when creating the branch)
git checkout --track -b <local branch> <remote>/<tracked branch>
Example
git checkout --track -b foo remote/foo