SORU
27 EKİM 2010, ÇARŞAMBA


Git rebase: çatışmaları engelleme ilerlemeye devam et

Usta daha dün yapılan bir git branch (v4 denir) var. V4 girmek istiyorum master için birkaç değişiklik vardı. Yani, v4, usta bir rebase yapmaya çalıştım, ve bir dosya içinde vidalama işleri devam: sürüm numarası içeren tek satırlık bir metin dosyası. Bu dosya rebasing önce bu metni içeren app/views/common/version.txt,:

v1.4-alpha-02

Yaptığım şey şu:

> 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".

version.txt şimdi bu gibi görünüyor:

<<<<<<< HEAD:app/views/common/version.txt
v1.4-alpha-02
=======
v1.4-alpha-01
>>>>>>> new version, new branch:app/views/common/version.txt

Yani, o temiz ben ve bu gibi görünüyor:

v1.4-alpha-02

ve sonra hayatıma devam etmeye çalıştım: ilk Başta bende deneyin:

> git commit -a -m "merged"
# Not currently on any branch.
nothing to commit (working directory clean)

Hiç şans yok. Yani, dosya eklemek için çalışıyordum

git add app/views/common/version.txt

Yanıt yok. Hiçbir haber iyi haber değildir, sanırım. Yani, devam etmek için çalışıyorum:

> 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".

Masadan kafamı yatmamın bir yuvarlak olacak ve bu turdan sonra bu noktada,,.

Burada neler oluyor? Neyi yanlış yapıyorum? Kimse net ayarlayabilirsiniz?

EDİT - unutbu için

Önerdiğin ve aynı hatayı alıyorum dosyayı değiştirdim:

> 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".

CEVAP
31 Ocak 2011, PAZARTESİ


Bir rebase ile benzer bir sorunla karşılaştım. Benim sorunum şu biri tek bir dosya değiştirildi taahhüt çünkü neden oldu, ve çözerken, değişim bu tanıtılan işlemek bir kenara bıraktım. İlgili tamamlama (git rebase --skip) atlayarak sorunumu çözmek için başardı.

Test deposunda bu sorunu yeniden oluşturabilirsiniz. İlk havuzu oluşturmak.

$ mkdir failing-merge
$ cd failing-merge
$ git init
Initialized empty Git repository in $HOME/failing-merge/.git/

Sonra ana version.txt özgün içerik işlemek.

$ echo v1.4-alpha-02 > version.txt
$ git add version.txt
$ git commit -m initial
[master (root-commit) 2eef0a5] initial
 1 files changed, 1 insertions( ), 0 deletions(-)
 create mode 100644 version.txt

v4 şube oluşturmak ve version.txt içeriğini değiştirin.

$ git checkout -b v4
Switched to a new branch 'v4'
$ echo v1.4-alpha-03 > version.txt
$ git add version.txt
$ git commit -m v4
[v4 1ef8c9b] v4
 1 files changed, 1 insertions( ), 1 deletions(-)

Rebase sırasında bir conflit olacak master dönüp version.txt içeriğini değiştirin.

$ git checkout master
Switched to branch 'master'
$ echo v1.4-alpha-04 > version.txt
$ git add version.txt
$ git commit -m master
[master 7313eb3] master
 1 files changed, 1 insertions( ), 1 deletions(-)

v4 şube geçin ve rebase çalışın. Planlandığı gibi version.txt bir conflit başarısız.

$ git checkout v4
Switched to branch 'v4'
$ git rebase master
First, rewinding head to replay your work on top of it...
Applying: v4
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging version.txt
CONFLICT (content): Merge conflict in version.txt
Recorded preimage for 'version.txt'
Failed to merge in the changes.
Patch failed at 0001 v4

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".
$ cat version.txt
<<<<<<< HEAD
v1.4-alpha-04
=======
v1.4-alpha-03
>>>>>>> v4

Biz version.txt master içeriği seçerek çakışmayı çözmek. Dosyayı ekliyoruz ve bizim rebase devam etmeye çalışacağım.

$ echo v1.4-alpha-04 > version.txt
$ git add version.txt
$ git rebase --continue 
Applying: v4
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 would prefer to skip this patch, instead run "git rebase --skip".
To restore the original branch and stop rebasing run "git rebase --abort".

Başarısız ! git bizim depo içinde olduğunu görelim.

$ git status
# Not currently on any branch.
nothing to commit (working directory clean)

Ah Ah, bir değişiklik yok. Eğer detaylı okursan önceki hata iletisi, git bu bizi haberdar etti ve git rebase --skip kullanmak için tavsiye. "Eğer hiçbir şey sahne için sol Varsa, şansını başka bir şey zaten aynı değişiklikleri tanıttı; bu yama atlamak isteyebilirsin." diye anlattı Biz sadece ve rebase taahhüt başarılı atlayın.

$ git rebase --skip
HEAD is now at 7313eb3 master

Uyarmam gerekirLütfen git rebase --skip tamamen git rebase için çalıştı drop unutmayın. Bizim durumumuzda, bu git bu taahhüt bir boş şikayetçi olduğu için sorun olmaması gerek. Eğer sence kaybettin değiştirdiğinde rebase tam kullanabilirsiniz git reflog git commit ıd deponuzu önce rebase ve kullanma git reset --hard almak için depo arkasında Devlet (bu başka bir yıkıcı operasyon).

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Alan Fullmer

    Alan Fullmer

    3 EYLÜL 2010
  • Chuck Testa

    Chuck Testa

    14 AĞUSTOS 2011
  • bored before i even began

    bored before

    30 Mart 2009