filter改写一个推送的提交消息

filter改写一个推送的提交消息

本文介绍了git filter-branch --msg-filter改写一个推送的提交消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何重新措词已被推送到专用遥控器的旧提交的消息?我想保留时间戳和标签.

How can I reword the message of an old commit that is already pushed to a private remote?I want to keep the time stamps and tags.

我在此处找到了此命令:

I found this command here:

git filter-branch -f --msg-filter \
'sed "s/<old message>/<new message>/g"' -- --all

为了保留我添加的标签:--tag-name-filter cat

In order to keep the tags i added: --tag-name-filter cat

执行命令git告诉我:味精过滤器失败

When executing the command git tells me: msg filter failed

我要更改的消息是合并消息合并分支'release/...'",这是问题吗?

The message I want to change is a merged-message "Merge branch 'release/...'" is this the problem?

推荐答案

解决方案是使用反斜杠将"release/..."中的斜杠转义.所以我使用的命令是:

The solution was to escape the slash in "release/..." using a backslash. So the command I used was:

git filter-branch -f --msg-filter \
'sed "s/release\/Version-[0-9].[0-9].[0-9]/develop/g"' \
--tag-name-filter cat -- --all

这篇关于git filter-branch --msg-filter改写一个推送的提交消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 03:33