当本地改变原点分支时,我失去了承诺
我的操作是:
- git pull
- git checkout origin/a
- 更改一些代码
- git add。
- git commit -m“修复:保存我的更改”
- git checkout b
- git checkout origin/a
我发现我的更改消失了。
My operation is :
- git pull
- git checkout origin/a
- changes some code
- git add.
- git commit -m "fix: save my changes"
- git checkout b
- git checkout origin/a
and I found my changes disappeared.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
结帐时(使用
git switch
the Way)代码>,您在独立的头模式。您应该:
git switch a
以创建本地分支a
链接到onecount/a
git branch -avv
to检查存在,并且具有origin/a作为上游git reflog
以找到您完成的提交git cherry-pick< sha1>
以在您的分支上获取该提交<代码> aWhen 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 brancha
linked toorigin/a
git branch -avv
to check a exists, and has origin/a as upstreamgit reflog
to find the commit you have donegit cherry-pick <sha1>
to get that commit on your brancha