当本地改变原点分支时,我失去了承诺

发布于 2025-01-18 15:12:04 字数 220 浏览 2 评论 0原文

我的操作是:

  1. git pull
  2. git checkout origin/a
  3. 更改一些代码
  4. git add。
  5. git commit -m“修复:保存我的更改”
  6. git checkout b
  7. git checkout origin/a

我发现我的更改消失了。

My operation is :

  1. git pull
  2. git checkout origin/a
  3. changes some code
  4. git add.
  5. git commit -m "fix: save my changes"
  6. git checkout b
  7. git checkout origin/a

and I found my changes disappeared.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

遗弃M 2025-01-25 15:12:04

结帐时(使用 git switch the Way)代码>,您在独立的头模式

您应该:

  • git switch a以创建本地分支a链接到onecount/a
  • git branch -avv to检查存在,并且具有origin/a作为上游
  • git reflog以找到您完成的提交
  • git cherry-pick&lt; sha1&gt;以在您的分支上获取该提交<代码> a

When you checkout (using git switch by the way) origin/a, you are in detached head mode.

You should:

  • git switch a to create a local branch a linked to origin/a
  • git branch -avv to check a exists, and has origin/a as upstream
  • git reflog to find the commit you have done
  • git cherry-pick <sha1> to get that commit on your branch a
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文