git 添加正则表达式示例

标签 git

我正在尝试使用

添加部分提交
git add -p

我选择了正则表达式选项

/ - search for a hunk matching the given regex

补丁包含这些行

+      AMFObject obj2;
+      AMFObjectProperty p;
+      AVal redirect;

但是git好像没有找到

search for regex? redirect
No hunk matches the given pattern

最佳答案

问题是这个补丁影响了多个文件。

我需要选择

d - do not stage this hunk nor any of the later hunks in the file

直到找到正确的文件,然后正则表达式才会起作用。

关于git 添加正则表达式示例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13323507/

相关文章:

Git:强制从特定分支 pull 出(并防止覆盖)

git - 无法放弃本地更改

objective-c - git DAG 的增量线性化

Git pull ,致命 : loose object

git - git submodule update --init 出错

git - 从 git 存储库中删除无关的提交

git - 使用仍在审查中的 Cherry pick 推送代码以供审查的工作流

node.js - 如何将 git prehook 添加到 tslint?

c# - 在 Visual Studio 中调试 Azure 函数

node.js - 部署时忽略 fsevents 依赖性