Tôi có một nhánh git (gọi là v4), được tạo ra từ chủ ngay hôm qua. Có một vài thay đổi để làm chủ, rằng tôi muốn nhận được vào v4. Vì vậy, trong v4, tôi đã cố gắng thực hiện rebase từ master, và một tập tin tiếp tục sửa đổi mọi thứ: một tệp văn bản một dòng, chứa số phiên bản. Tập tin này là app/views/common/version.txt
, mà trước rebasing chứa văn bản này:Khởi động lại Git: xung đột ngăn chặn tiến trình
v1.4-alpha-02
Đây là những gì tôi đang làm:
> git rebase master
First, rewinding head to replay your work on top of it...
Applying: new version, new branch
error: patch failed: app/views/common/version.txt:1
error: app/views/common/version.txt: patch does not apply
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging app/views/common/version.txt
CONFLICT (content): Merge conflict in app/views/common/version.txt
Failed to merge in the changes.
Patch failed at 0001 new version, new branch
When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To restore the original branch and stop rebasing run "git rebase --abort".
Các version.txt
bây giờ trông như thế này:
<<<<<<< HEAD:app/views/common/version.txt
v1.4-alpha-02
=======
v1.4-alpha-01
>>>>>>> new version, new branch:app/views/common/version.txt
Vì vậy, tôi dọn dẹp nó và trông giống như sau:
v1.4-alpha-02
và sau đó tôi đã cố gắng để tiếp tục: lúc đầu tôi thử một cam kết:
> git commit -a -m "merged"
# Not currently on any branch.
nothing to commit (working directory clean)
Không may mắn đó. Vì vậy, tôi đã cố thêm tệp:
git add app/views/common/version.txt
Không phản hồi. Không có tin tức là tin tốt, tôi đoán vậy. Vì vậy, tôi cố gắng tiếp tục:
> git rebase --continue
Applying: new version, new branch
No changes - did you forget to use 'git add'?
When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To restore the original branch and stop rebasing run "git rebase --abort".
Đó là vào thời điểm này, sau khi đi vòng quanh với điều này, tôi đang đập đầu của tôi ra khỏi bàn làm việc.
Điều gì đang xảy ra ở đây? Tôi đang làm gì sai? Ai có thể đặt tôi thẳng không?
EDIT - cho unutbu
Tôi đã thay đổi các tập tin như bạn đề nghị và nhận được lỗi tương tự:
> git rebase master
First, rewinding head to replay your work on top of it...
Applying: new version, new branch
error: patch failed: app/views/common/version.txt:1
error: app/views/common/version.txt: patch does not apply
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging app/views/common/version.txt
CONFLICT (content): Merge conflict in app/views/common/version.txt
Failed to merge in the changes.
Patch failed at 0001 new version, new branch
When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To restore the original branch and stop rebasing run "git rebase --abort".
cảm ơn vì đã đặt câu hỏi này .. Tôi đã đối mặt với cùng một vấn đề –
sẽ rất tuyệt nếu bạn xác nhận một số câu trả lời – holms
@MaxWilliams, tôi nghĩ bạn (như tôi) đã hiểu sai [@unutbu] (http: // stackoverflow. com/a/4033058/277826) 's lời khuyên: 1) đầu tiên bạn chạy 'git rebase master' _và để cho nó fail_; 2) sau đó bạn chỉnh sửa 'version.txt' và làm cho nó như là nó nên nhìn vào điểm đó, và lưu chỉnh sửa; 3) sau đó bạn 'git add .../version.txt'; 4) sau đó bạn làm 'git rebase --continue' (_ ** not ** 'commit'_)! Nếu 'rebase --continue' thành công ở đây, _it đã được commit_ (không cần' git commit' ở đây!) - vì vậy tất cả những gì còn lại phải làm là 'git push' (nếu bạn sử dụng repo từ xa). Hy vọng điều này sẽ giúp, nếu tôi hiểu đúng ':)' - chúc mừng! – sdaau