如何在不重新创建创建补丁的原始结构的情况下应用 git 补丁
How to apply a git patch without recreating the original structure where it was made
我正在尝试将此补丁应用于文件 (bi_janrain_data/js/bi_janrain_data.js):
# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- a/<html>bi_janrain_data.js (<b>Dec 28, 2017 12:15:26 PM</b>)</html>
+++ b/<html><b>Current File</b></html>
@@ -51,25 +51,25 @@
});
$('#janDataList_filter').hide();
- $('.container-inline-date').hide();
+ $('#block-bi-janrain-data-filter-options .container-inline-date').hide();
$("#edit-filteroption").change(function() {
if($(this).val() == 'rDate') {
$('#janDataList_filter').hide();
- $('.container-inline-date').show();
+ $('#block-bi-janrain-data-filter-options .container-inline-date').show();
$('#custom2').val('');
}
else if($(this).val() == ''){
$('#janDataList_filter').hide();
- $('.container-inline-date').hide();
+ $('#block-bi-janrain-data-filter-options .container-inline-date').hide();
$('#edit-datestart-datepicker-popup-0').val('');
$('#edit-dateend-datepicker-popup-0').val('');
table.draw();
}
else {
$('#janDataList_filter').show();
- $('.container-inline-date').hide();
+ $('#block-bi-janrain-data-filter-options .container-inline-date').hide();
$('#edit-datestart-datepicker-popup-0').val('');
$('#edit-dateend-datepicker-popup-0').val('');
table.draw();
但它给了我这些错误:
git apply "bi_janrain_data\inline-class-change.patch"
bi_janrain_data/inline-class-change.patch:10: trailing whitespace.
$('#block-bi-janrain-data-filter-options .container-inline-date').hide();
bi_janrain_data/inline-class-change.patch:16: trailing whitespace.
$('#block-bi-janrain-data-filter-options .container-inline-date').show();
bi_janrain_data/inline-class-change.patch:23: trailing whitespace.
$('#block-bi-janrain-data-filter-options .container-inline-date').hide();
bi_janrain_data/inline-class-change.patch:31: trailing whitespace.
$('#block-bi-janrain-data-filter-options .container-inline-date').hide();
error: <html><b>Current File</b></html>: No such file or directory
我也试过这个:
git apply -p1 "bi_janrain_data\js\bi_janrain_data.js" "bi_janrain_data\inline-class-change.patch"
error: unrecognized input
修改补丁文件头。在当前状态下,git 不知道要应用到哪个文件。
之前:
--- a/<html>bi_janrain_data.js (<b>Dec 28, 2017 12:15:26 PM</b>)</html>
+++ b/<html><b>Current File</b></html>
之后:
--- a/bi_janrain_data/js/bi_janrain_data.js
+++ b/bi_janrain_data/js/bi_janrain_data.js
我正在尝试将此补丁应用于文件 (bi_janrain_data/js/bi_janrain_data.js):
# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- a/<html>bi_janrain_data.js (<b>Dec 28, 2017 12:15:26 PM</b>)</html>
+++ b/<html><b>Current File</b></html>
@@ -51,25 +51,25 @@
});
$('#janDataList_filter').hide();
- $('.container-inline-date').hide();
+ $('#block-bi-janrain-data-filter-options .container-inline-date').hide();
$("#edit-filteroption").change(function() {
if($(this).val() == 'rDate') {
$('#janDataList_filter').hide();
- $('.container-inline-date').show();
+ $('#block-bi-janrain-data-filter-options .container-inline-date').show();
$('#custom2').val('');
}
else if($(this).val() == ''){
$('#janDataList_filter').hide();
- $('.container-inline-date').hide();
+ $('#block-bi-janrain-data-filter-options .container-inline-date').hide();
$('#edit-datestart-datepicker-popup-0').val('');
$('#edit-dateend-datepicker-popup-0').val('');
table.draw();
}
else {
$('#janDataList_filter').show();
- $('.container-inline-date').hide();
+ $('#block-bi-janrain-data-filter-options .container-inline-date').hide();
$('#edit-datestart-datepicker-popup-0').val('');
$('#edit-dateend-datepicker-popup-0').val('');
table.draw();
但它给了我这些错误:
git apply "bi_janrain_data\inline-class-change.patch"
bi_janrain_data/inline-class-change.patch:10: trailing whitespace.
$('#block-bi-janrain-data-filter-options .container-inline-date').hide();
bi_janrain_data/inline-class-change.patch:16: trailing whitespace.
$('#block-bi-janrain-data-filter-options .container-inline-date').show();
bi_janrain_data/inline-class-change.patch:23: trailing whitespace.
$('#block-bi-janrain-data-filter-options .container-inline-date').hide();
bi_janrain_data/inline-class-change.patch:31: trailing whitespace.
$('#block-bi-janrain-data-filter-options .container-inline-date').hide();
error: <html><b>Current File</b></html>: No such file or directory
我也试过这个:
git apply -p1 "bi_janrain_data\js\bi_janrain_data.js" "bi_janrain_data\inline-class-change.patch"
error: unrecognized input
修改补丁文件头。在当前状态下,git 不知道要应用到哪个文件。
之前:
--- a/<html>bi_janrain_data.js (<b>Dec 28, 2017 12:15:26 PM</b>)</html>
+++ b/<html><b>Current File</b></html>
之后:
--- a/bi_janrain_data/js/bi_janrain_data.js
+++ b/bi_janrain_data/js/bi_janrain_data.js