今天我有一個奇怪的rebase體驗。我不明白哪裏出了問題。你能否請回顧一下,看看我是否犯了明顯的錯誤。最終的結果似乎沒問題,但我不明白我應該如何做到這一點。git rebase:解釋如何做得更好?
我想拉一些同事的變化,但有變化,我還沒有提交。所以我第一次承諾我的變化:
$ git commit -a -m "variablekey::assignMissing zapspace after semi-colon separation"
[master d8b462f] variablekey::assignMissing zapspace after semi-colon separation
3 files changed, 11 insertions(+), 3 deletions(-)
我用拉和rebase。我想拉取所有更新,然後將我的提交應用於其上。
$ git pull --rebase
X11 forwarding request failed on channel 0
First, rewinding head to replay your work on top of it...
Applying: variablekey::assignMissing zapspace after semi-colon separation
Using index info to reconstruct a base tree...
M package/kutils/R/variableKey.R
Falling back to patching base and 3-way merge...
Auto-merging package/kutils/R/variableKey.R
CONFLICT (content): Merge conflict in package/kutils/R/variableKey.R
error: Failed to merge in the changes.
Patch failed at 0001 variablekey::assignMissing zapspace after semi-colon separation
The copy of the patch that failed is found in: .git/rebase-apply/patch
When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".
這是可以預料的。我編輯了文件「variableKey.R」。我發現它的部分是< < == >>並糾正了代碼。編輯文件後,我跑
$ git add .
$ git commit -m "Edited variableKey to resolve conflicts"
[detached HEAD dbc8e16] Resolved merge conflict
5 files changed, 500 insertions(+), 4 deletions(-)
create mode 100644 package/kutils/R/cfaTable.R-pj
create mode 100644 package/kutils/R/import-1.R
$ git rebase --continue
Applying: variablekey::assignMissing zapspace after semi-colon separation
No changes - did you forget to use 'git add'?
If there is nothing left to stage, chances are that something else
already introduced the same changes; you might want to skip this patch.
When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".
它發現沒有變化,並想知道如果我跑了git add,但我做到了。
$ git status .
rebase in progress; onto 2a68a60
You are currently rebasing branch 'master' on '2a68a60'.
(all conflicts fixed: run "git rebase --continue")
nothing to commit, working tree clean
這裏的手動:針對https://help.github.com/articles/resolving-merge-conflicts-after-a-git-rebase警告,說:「你可以用git變基--skip完全跳過提交這意味着,沒有一個由問題帶來的變化,提交將包括它。你很少會選擇這個選項。「
無論如何我最終運行了「git rebase --skip」。
我發現這些每年只用兩到三次的git功能是非常棘手的,我忘記了這些細微差別。
謝謝。由於沒有人與你的答案爭論,我相信你是正確的。 – pauljohn32