假设我拥有<?php
// STEP 1: Read POST data
// reading posted data from directly from $_POST causes serialization
// issues with array data in POST
// reading raw POST data from input stream instead.
foreach($_REQUEST as $key=>$value){
$reqa .= "&$key=$value";
}
$fh = fopen('log/invalid-lol.txt','w');
fwrite($fh,$reqa);
fclose($fh);
$raw_post_data = file_get_contents('php://input');
$raw_post_array = explode('&', $raw_post_data);
$myPost = array();
foreach ($raw_post_array as $keyval) {
$keyval = explode ('=', $keyval);
if (count($keyval) == 2)
$myPost[$keyval[0]] = urldecode($keyval[1]);
}
// read the post from PayPal system and add 'cmd'
$req = 'cmd=_notify-validate';
if(function_exists('get_magic_quotes_gpc')) {
$get_magic_quotes_exists = true;
}
foreach ($myPost as $key => $value) {
if($get_magic_quotes_exists == true && get_magic_quotes_gpc() == 1) {
$value = urlencode(stripslashes($value));
} else {
$value = urlencode($value);
}
$req .= "&$key=$value";
}
// STEP 2: Post IPN data back to paypal to validate
$ch = curl_init('https://ipnpb.sandbox.paypal.com/cgi-bin/webscr'); // change to [...]sandbox.paypal[...] when using sandbox to test
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: Close'));
// In wamp like environments that do not come bundled with root authority certificates,
// please download 'cacert.pem' from "http://curl.haxx.se/docs/caextract.html" and set the directory path
// of the certificate as shown below.
// curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__) . '/cacert.pem');
if( !($res = curl_exec($ch)) ) {
// error_log("Got " . curl_error($ch) . " when processing IPN data");
curl_close($ch);
exit;
}
curl_close($ch);
// STEP 3: Inspect IPN validation result and act accordingly
if (strcmp ($res, "VERIFIED") == 0) {
// check whether the payment_status is Completed
// check that txn_id has not been previously processed
// check that receiver_email is your Primary PayPal email
// check that payment_amount/payment_currency are correct
// process payment
// assign posted variables to local variables
$item_name = $_POST['item_name'];
$item_no = $_POST['item_number'];
$payment_status = $_POST['payment_status'];
if ($_POST['mc_gross'] != NULL)
$payment_amount = $_POST['mc_gross'];
else
$payment_amount = $_POST['mc_gross1'];
$payment_currency = $_POST['mc_currency'];
$txn_id = $_POST['txn_id'];
$txn_type = $_POST['txn_type'];
$case_type = $_POST['case_type'];
$receiver_email = urldecode($_POST['receiver_email']);
$payer_email = urldecode($_POST['payer_email']);
foreach($_POST as $key=>$value){
$req .= "&$key=$value";
}
$rand = rand(0,99);
$fh = fopen('log/valid-'.$rand.'-'.$item_no.'.txt','w');
fwrite($fh,$req);
fclose($fh);
} else if (strcmp ($res, "INVALID") == 0) {
$rand = rand(1000,99999);
$fh = fopen('log/invalid-'.$rand.'.txt','w');
fwrite($fh,$req);
fclose($fh);
}
?>
并具有最新功能,然后我拥有branchA
,其修补程序尚未同步到branchB
。
我想做的是将所有修补程序合并到该最新功能(branchA
)中,但仅合并差异。
我看到branchA
实际上显示了git log branchA..branchB
中尚不存在的branchB
中的提交。不幸的是,我不知道该命令如何将branchA
diff提交合并到branchB
答案 0 :(得分:1)
您非常亲密。您可以将其作为补丁:
git diff branchA..branchB > mypatch.patch
然后将补丁应用到所需的分支:
git apply mypatch.patch
答案 1 :(得分:0)
简单地...
git checkout brancha
git merge branchb
答案 2 :(得分:0)
如果要将分支 X 的更改应用到当前分支:
git diff ..X | git apply -
这只是已接受答案的简短版本。