git - 删除 git 中的某些提交
问题描述
你能建议我如何恢复到早期的良好承诺。下面是我的提交代码
git log --oneline
as4c704 (HEAD -> mybranch, origin/master, origin/HEAD, master) Merge branch 'branchA' of repo_name into master
e325c09 (origin/branchA) message
4549e4c Merge branch 'branchB' of repo_name into master
2f32d73 (origin/branchB) Merge remote-tracking branch 'origin/master' into branchB
221e689 Merge branch 'branchC' of repo name into master
f33c1c (origin/branchC) Merge remote-tracking branch 'origin/master' into branchC
6782c19 Merge branch 'branchD' of repo_name into master
1d3s525 Merge branch 'branchE' of repo_name into master
16438a DbranchE
112a682 message
dd3d883 BranchF message
5122492 BranchF message
bg3e17 message
33f71c message
346d27 message
... more
我如何保留提交 346d27、33f71c 和 221e689 并从 33f71c 开始将其删除
解决方案
您必须发出命令git rebase -i 33f71c
并编辑要删除的每个提交输入drop
命令。
然后保存、退出并发出命令git push --force
。
推荐阅读
- c - 打印 wchar_t 作为 wchar_t* 字符串的一部分不会终止
- c - 关于比较指针和整数的警告
- python - 用于拟合 ODE 的 odr 函数:格式化 np 数组
- oracle - 临时表 DBstats
- sql - 在表中查找唯一值
- javascript - Mongoose 从 Schema.find({}) 返回可统一的数组?
- c++ - 无法运行 qt 的 qt 演示,因为找不到 Cocoa 插件 - Macos
- java - 从 Documentum 查询中读取自定义双精度值
- microsoft-graph-api - 使用图形资源管理器在 ms 图形报告 api 中没有得到响应
- c - How to qsort array of integer pointers?