我知道如何交互式地修改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
有什么想法吗?
发布于 2020-03-03 08:41:31
摘自here (感谢jonrsharpe):
# 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 -p --onto $i^ $i
done
https://stackoverflow.com/questions/60502935
复制相似问题