我正在使用合并一堆提交cherry-pick
git rev-list --reverse something-begin..something-end | git cherry-pick --stdin
Run Code Online (Sandbox Code Playgroud)
然后以错误消息结束
...
You are currently cherry-picking commit xxxyyy.
nothing to commit, working tree clean
The previous cherry-pick is now empty, possibly due to conflict resolution.
If you wish to commit it anyway, use:
git commit --allow-empty
If you wish to skip this commit, use:
git reset
Then "git cherry-pick --continue" will resume cherry-picking the remaining commits.
Run Code Online (Sandbox Code Playgroud)
我不想选择任何这些空提交。
git reset; git cherry-pick --continue每次停靠和提示都要输入,这很烦人。
为什么它没有提供一个--skip-empty选项?然后我就到了这个线程:
太糟糕了,我检查了我的 git 版本2.9.3,甚至发现它cherry-pick不支持任何--skip-empty一个或--empty-commpit=skip任何其他。
我检查过git rev-list有一个选项--remove-empty,但它没有任何帮助。
最后我找到了解决方案。
git rev-list --reverse something-begin..something-end . | git cherry-pick --stdin
Run Code Online (Sandbox Code Playgroud)
在命令中添加一个点rev-list(即路径部分)将为我跳过所有空提交(这是--remove-empty做什么的??)
| 归档时间: |
|
| 查看次数: |
7700 次 |
| 最近记录: |