git :克隆远程存储库,签出分支,提交更改...如何更新远程分支?

发布于 2024-12-26 01:09:20 字数 1006 浏览 0 评论 0原文

这就是遥控器的样子。

--C0--------------C4--  (master) 
      \
       --C1-C2-C3--     (lite_main)

我采取的操作:

  1. 克隆远程存储库
  2. ,签出 lite_main
  3. 进行了一些更改并提交了

来自 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:

  1. cloned the remote repo
  2. checked out lite_main
  3. 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

若能看破又如何 2025-01-02 01:09:20

您所要做的就是:

git push origin lite_main

此外,如果您想在创建分支时跟踪远程,您可以运行命令(创建分支时) git checkout --track -b;/<跟踪分支>

示例 git checkout --track -b foo remote/foo

All you have to do is:

git push origin lite_main

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文