git - 修复 git 历史混乱
问题描述
我以某种方式完全搞砸了我的历史,现在我的日志图顶部有这个怪物:
$ git log --oneline --decorate --graph --all | head
* 9287659 (HEAD -> production, origin/production) Merge branch 'master' into production
|\
| * 7e7237a (origin/master, origin/HEAD, master) Reports on LaMP validation history now
* | a7b2c39 Merge branch 'master' into production
|\ \
| * | d8f2320 Reports on LaMP validation history now - LaMP/LaMP-Service#31
| |/
* | a8c6183 Reports on LaMP validation history now
|/
* caa80f6 T&M report only includes completed assessments. Added a 'lab' tab to the download
在这一点上,我的“主”和“生产”分支都应该指向完全相同的东西。我希望我的图表看起来像这样:
* somenum Reports on LaMP validation history now - LaMP/LaMP-Service#31
* caa80f6 T&M report only includes completed assessments. Added a 'lab' tab to the download
HEAD、production、master、origin/production 和 origin/master 都应该指向顶行。
我是唯一有权访问此存储库的人,因此覆盖远程存储库很好。
我试过做一个rebase反对caa80f6
,这只会让情况变得更糟。
解决方案
由于您是唯一使用它的人,因此变基应该没问题。您可以将提交压缩在一起。
git rebase -i caa80f6
我想这就是你想要的。'f' 将压缩并丢弃提交消息。
f a8c6183 关于 LaMP 验证历史的报告现在
选择 d8f2320 关于 LaMP 验证历史的报告
f a7b2c39 将分支“主”合并到生产
中 f 7e7237a(源/主,源/头,主)
f 9287659(头 -> 生产,源/生产)
推荐阅读
- python - 当我第二次尝试登录谷歌时出现使用另一个帐户选项
- javascript - 在 nextjs 中未正确返回更新的对象
- ip - 具有多个 IP 的模拟虚拟需求环境
- r - 如何生成字符串列表的所有排列?
- database - laravel 中的电子商务过滤器查询/逻辑
- c# - 握住手机时陀螺仪控制的相机抖动
- mongodb - 保存到 mongodb:py4j.Py4JException:Python 代理引发异常
- sql - 每月提供利润的代理的 SQL 计数
- css - 从我使用 create-react-app 的 react 项目中删除 node-sass
- amazon-web-services - 模板的输出块中未解决的资源依赖项 [BasicAWSApiGateway]