git - 如何将提交压缩到最后一次提交?- 订单问题
问题描述
在我工作的公司中,我们使用 Gerrit(不幸的是),我需要将非推送的提交扁平化为一个提交。当我检查 InteliJ 中的提交列表时,我看到:
ed4ad5ffd67504a37a43ae6bf66d0f31456e4e81 (HEAD -> develop) [CSTC-1096] ESlint implementation with fixed files
f70a86aabb5bb5f6c8890688aad543c94d8891bb Merge branch 'migrating-from-tslint-to-eslint' into develop
3a6217f7cf98463176c3959d109868497f2c8928 (origin/migrating-from-tslint-to-eslint, migrating-from-tslint-to-eslint) ign
ore webpack.config.js file
04689eafd432f90ede9a5ce9e1474af0474ea176 (origin/develop) [CSTC-1087]: Poprawka do konfiguracji
c6393dd6201099535bef94e36066819dd1dd1467 add package-lock
205c5e97cf0c031df4d63e579a0e2a5f41470014 readme update
339a23faf5bad941d86a4d3160ae8eaebaf57b07 add husky and lint-staged
047aff160006c70b257f931fd2133cdaa54cc1e1 [CSTC-1090]: Dodanie logiki wyświetlania komponentów
5c46bdab5490f07a15067a9b2dfa14c804f7eb1e eslint reinstallation
ddbeac7ed37fffca6a7587f7cbee43faececb394 removal of eslint and update of readme
302d3c1b4c728078decf826347eed9ef49161a74 [CSTC-532] translation fixes and update styles for datepicker
但是,当我输入时,git rebase --interactive 302d3c1b4c728078decf826347eed9ef49161a74
我可以看到:
pick 047aff1 [CSTC-1090]: Dodanie logiki wyświetlania komponentów
pick 04689ea [CSTC-1087]: Poprawka do konfiguracji
pick ddbeac7 removal of eslint and update of readme
pick 5c46bda eslint reinstallation
pick 339a23f add husky and lint-staged
pick 205c5e9 readme update
pick c6393dd add package-lock
pick 3a6217f ignore webpack.config.js file
pick ed4ad5f [CSTC-1096] ESlint implementation with fixed files
因此,如果我对所有提交(第一个除外)进行压缩,我的最终提交将是[CSTC-1090]: Dodanie logiki wyświetlania komponentów
. 我希望最终提交是创建的最后一个提交([CSTC-1096] ESlint implementation with fixed files
)
解决方案
结果提交既不是第一个也不是最后一个,它将是两者之间所有提交的组合。
默认情况下,使用的消息是所有消息的组合,但大多数工具只显示第一行,这将是第一次提交的消息。
因此,您想要的是“只是”选择正确的消息用于生成的提交。使用时stash
,Git 应该已经询问您要使用的信息:只要确保使用您真正想要的信息。
推荐阅读
- matlab - 在 Matlab 中使用多个 2D 图像的 3D 点云
- javascript - indexOf() 仅适用于数组中的单个值
- c# - 在 Visual Studio 2017 的设计屏幕上显示标签
- javascript - 如何在 javascript 中将 .String 键转换为对象
- ios - 如何使用swift更改Json中某些参数的数据
- linux - Docker:压缩文件但排除某些文件夹
- angular - 你能在离子选择中触发方法吗,就像你会触发一样 (click)="method()"
- python - 如何识别使用 tkInter 按下了哪个单选按钮?
- openedge - 如何查看智能字段中的数据?
- c# - 功能不从相机获取位置