【发布时间】:2020-03-03 08:25:42
【问题描述】:
我知道如何以交互方式修改 git 历史记录和 drop 特定提交,但我没有找到完全自动完成此操作的方法。
我想识别特定的提交(例如,包含一个魔术字符串)并让它们被脚本删除。
类似这样的:
# identify and remove all commits which would be merged to master but should not
for i in $(git --no-pager log --grep='no-push' --pretty=format:"%h" --no-merges HEAD ^master)
do
echo "Drop commit $i"
git rebase --drop $i # <== this is what I want to do
done
有什么想法吗?
【问题讨论】:
标签: bash git shell git-rebase