如何运行git rebase交互模式来删除重复的提交 [英] How to run git rebase interactive mode to remove duplicate commits

查看:107
本文介绍了如何运行git rebase交互模式来删除重复的提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我重新进行最近的提交时,我犯了一个错误。 (我忘记了先获取 - 全部,然后重新分配),并且自从承诺并推送到远程分支。现在我先通过提取来解决冲突,然后推送到远程分支,从而正确完成了分配。现在,似乎我最近的所有提交都显示了两次。我想要做的是使用git rebase交互模式,选择我想要的所有提交,然后正确地将其转换为提交sha代码。
这是做到这一点的方法吗?如果我启动git rebase -i,我应该使用哪个sha代码,原始分支点sha代码?或最近的sha代码?
Thanks,

David

解决方案

重复的提交。这里是我做的:硬重置到分支点,从原点拉,启动git rebase -i SHACODE(原始分支点),选择我想保留的提交,git rebase当前SHACODE。


I made a mistake when I rebase to a recent commit. ( I forgot to "git fetch --all" first, then rebase), and I've committed and pushed to the remote branch since. Now I did the rebase properly by fetching first, solved the conflicts, and pushed to the remote branch. Now, it seems all my recent commits are showing up twice. What I would like to do is to use git rebase interactive mode, pick all the commits that I want, then rebase properly to the commit sha code. Is this the way to do this? and if I start git rebase -i, which sha code should I use, the original branching point sha code? or the most recent sha code? Thanks,

David

解决方案

I successfully removed the duplicate commits. Here is what I did: hard reset to the branching point, pull from origin, start git rebase -i SHACODE (original branching point), pick the commits that I want to keep, git rebase to the current SHACODE.

这篇关于如何运行git rebase交互模式来删除重复的提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆