首先道歉,我是一个有抱负的git大师,但还不太清楚。。。
我目前有5个本地提交尚未推送到我的远程分支;前两个禁止我推,因为他们
尾随/前导空格错误
在一些源文件中。
当我试图推动。。。
$ git push -u origin my-branch
我收到以下错误。。。
$ git push -u origin my-branch
Counting objects: 124, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (122/122), done.
Writing objects: 100% (124/124), 23.19 KiB | 3.31 MiB/s, done.
Total 124 (delta 94), reused 2 (delta 2)
remote: Resolving deltas: 100% (94/94), completed with 16 local objects.
remote: bin/pre_receive_hook: failed with exit status 1
remote: Starting pre_receive_hook.rb at 02:30:52.384
remote: Updating refs/heads/my-branch from 89e1e6deeec412a914c4cfc4c6dec101b15ba4c5 to 0cd270067efecff743505d6613c2cff07a4f7f14
remote: Running Conventions Check...
remote: Starting ConventionCheck at 02:30:53.162
remote: Checking Commit 0cd270067: OB-221 Remove pry bindings left in spec, remove leading/trailing spaces in files, add newline to end of files
remote: Checking Commit 1342336cd: OB-221 Remove pry bindings left in spec
remote: Checking Commit 7dc993531: OB-221 Refactored SoapRequest and CalculateInvoiceTaxRequest to accomodate a more traditional Adapter pattern
remote: Trailing/Leading spaces error, use --check in your diff to see the problem: Conventions
To github.my-site.com:my-site/argh_express.git
! [remote rejected] OB-221-taxware-api-adapter -> OB-221-taxware-api-adapter (pre-receive hook declined)
error: failed to push some refs to 'git@github.my-site.com:on-site/argh_express.git'
我已将尾随/前导空格错误缩小到提交到前两(2)次提交的源文件,使用
$ git diff --check -R 7dc993531 bbfd2723d
产生以下输出(尾随空格由\b表示)
ROOT/rails/app/models/integration/tax_ware/calculate_invoice_tax_result_model.rb:100: trailing whitespace.
+\b\b\b\b\b\b\b
ROOT/rails/spec/models/integration/tax_ware/soap_request_spec.rb:17: trailing whitespace.
+\b\b
ROOT/rails/spec/models/integration/tax_ware/soap_request_spec.rb:18: trailing whitespace.
+ let(:soap_request) do\b
因此,错误的提交如下(以粗体标记)
-
0CD27067
-
1342336cd
-
7dc993531
-
9ca4f853f
<<<尾随空格
-
bbfd2723d
<<<尾随空格
我基本上想
-
修复那些源文件(这对我来说没有太大意义,因为文件已随最近的注释而更改)或
-
以某种方式推送最近的提交(0cd270067)
但是,最近的提交并不包含需要推送的所有文件!
如何推动最近的本地提交,包括我需要的所有文件,并放弃以前的所有本地提交?