清理 git rebase (应该有 git pull)
我正在从一个分支进行 git rebase,在那里我选择了 3 个更改,但 rebase 为 10 个,我真的希望我使用了 git pull。我想我还在学习 git。更改已发布...
我宁愿进行 git pull,因此仅将 3 个签入添加到上部分支,而不是对上部分支中的十几个提交进行变基。
有办法清理这个吗?或者继续前进。 Github 不会让我撤销提交,这可能是有充分理由的。
I'm doing a git rebase from a branch, where I picked up 3 changes but rebased like 10, I really wish I had used git pull. I guess I am s[till learning git. The changes were published...
I'd rather have done a git pull, so only the 3 checkins are added to the upper branch rather than rebaseing the dozen or so commits in the upper branch.
Is there a way to clean this up? Or just move on. Github won't let me back out the commit, probably for good reason.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您始终可以重置回变基之前的状态,然后进行拉取 - 使用 git reflog 找出变基之前的哈希值,然后使用
git reset --hard
将您的分支重置为该 SHA。然后正常进行 git pull 。一旦达到您想要的状态,您可以使用--force
标志推送回 github。您可能需要先备份
.git
文件夹,以防万一。You could always just reset back to the state you were at before the rebase and then do a pull instead - use
git reflog
to figure out the hash that you used to be at before the rebase, and then usegit reset --hard <sha>
to reset your branch to that SHA. Then do the git pull normally. Once you're to the state you'd prefer to be at, you can push back to github using the--force
flag.You may want to make a backup of your
.git
folder first, just in case.