Git:要重播的第一个倒带头

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22320058/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 17:52:09  来源:igfitidea点击:

Git: First rewinding head to replay

gitgit-branchrebase

提问by Rollerball

I am getting this message:

我收到这条消息:

 First, rewinding head to replay your work on top of it...

each time I do a git pull --rebase origin <branch>, however I would like to discard all my work that may be replayed on top of it.. Basically I would like to rebase only the origin branch without my work on top of it. How can I clean those commits that comes up wrongly all times I try to pull rebase? Again, my goal is just pull rebase the exact snapshot of the origin branch without my work on top of it. Thanks in advance.

每次我做一个git pull --rebase origin <branch>,但是我想放弃我所有可能在它上面重播的工作..基本上我只想重新定位原始分支,而不是我的工作。我如何才能清除那些每次尝试拉动变基时出现错误的提交?同样,我的目标只是拉取原始分支的确切快照的 rebase,而无需我在其上进行工作。提前致谢。

回答by aragaer

git fetch origin; git reset --hard origin/<branch>

git fetch origin; git reset --hard origin/<branch>