Git 指定修补程序应应用于哪个文件
例如,我有以下git修补程序:Git 指定修补程序应应用于哪个文件,git,Git,例如,我有以下git修补程序: diff --git a/Gruntfile.js b/Gruntfile.js index d220f35..176c71a 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -10,7 +10,7 @@ module.exports = function (grunt) { src: ['index.less', '!**/components/**'],
diff --git a/Gruntfile.js b/Gruntfile.js
index d220f35..176c71a 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -10,7 +10,7 @@ module.exports = function (grunt) {
src: ['index.less', '!**/components/**'],
dest: 'build/development/css',
ext: '.css',
- cleancss: true
+ cleancss: false
}
]
},
如您所见,它包含应用这些更改的文件的路径(
grunfile.js
)。除了修补程序中指定的文件外,是否有其他方法将此修补程序应用于该文件?您应该能够直接指定要修补的文件:
$ patch not-Gruntfile-but-close.js unset-cleancss.patch
谢谢,应该是
git apply not-Gruntfile-but-close.js unset cleancss.patch
?是和否。在我看来,git apply
不允许您指定要修补的文件;它只使用补丁文件本身中的内容。另一方面,如果您不需要任何其他选项来应用git
,您应该能够直接使用patch
程序来应用补丁。谢谢,这个patch
程序与git
有什么关系吗?我在哪里可以阅读更多关于它的信息?man patch
。这是一个已经存在很长时间的计划;我不确定git apply是否在引擎盖下使用了patch
,或者只是实现了相同的算法。