2017-11-18 10 views
0

私はある時間前にマスターから取得した機能ブランチを持っています。今、私はその機能ブランチにマスターをリベースしたいので、私は、このコマンドをした:マスタブランチをフィーチャブランチにリベースすると、リベース後に再度競合が発生する

git rebase master 

私は衝突を得たのでその後、私はSourceTreeに続けました。私はそれらを一つずつ解決した後、リベースを続けたが、これはしばらく続いた。最後にすべてが完了したように見えて非常に幸せ。

これはSourcetreeは今私を示したものです:

enter image description here

私は

git rebase master 

を実行すると、私が行うと、私は

Current branch 2FA is up to date.Current branch 2FA is up to date. 

を得る:

git pull 

私は再度やり直す必要があるファイルのリストを取得します。

Auto-merging db/schema.rb 
CONFLICT (content): Merge conflict in db/schema.rb 
Auto-merging config/locales/nl.yml 
CONFLICT (content): Merge conflict in config/locales/nl.yml 
Auto-merging app/views/users/_form.html.haml 
CONFLICT (content): Merge conflict in app/views/users/_form.html.haml 
Auto-merging app/models/user.rb 
CONFLICT (content): Merge conflict in app/models/user.rb 
Auto-merging app/models/permission.rb 
CONFLICT (content): Merge conflict in app/models/permission.rb 
Auto-merging app/helpers/application_helper.rb 
CONFLICT (content): Merge conflict in app/helpers/application_helper.rb 
Auto-merging app/controllers/users_controller.rb 
CONFLICT (modify/delete): app/controllers/companies_controller.rb deleted in HEAD and modified in 1110e1f18d4ab388eab767509d95be10b9953a36. Version 1110e1f18d4ab388eab767509d95be10b9953a36 of app/controllers/companies_controller.rb left in tree. 
Auto-merging app/assets/stylesheets/custom.css.sass 
CONFLICT (content): Merge conflict in app/assets/stylesheets/custom.css.sass 
Auto-merging app/assets/stylesheets/backapp.css 
CONFLICT (content): Merge conflict in app/assets/stylesheets/backapp.css 
Auto-merging Gemfile.lock 
CONFLICT (content): Merge conflict in Gemfile.lock 
Auto-merging Gemfile 
CONFLICT (content): Merge conflict in Gemfile 
Automatic merge failed; fix conflicts and then commit the result. 

これはなぜですか?私はすでにそれを理解する作業をしました。このようにリベースするのは、単にマージするよりはるかに多くの作業のようです。

答えて

0

フィーチャーブランチをmasterにリベースしたときに、そのブランチの履歴が書き換えられました。実際に起こったことは、あなたがmasterブランチの上で自分の作品を再生したことです。あなたはリベースを完了したら、行うには通常の事は、リモートにあなたの機能ブランチをプッシュ強制的にされているでしょう:

git push --force origin feature 

あなたがgit pullをした時に何が起こったあなたは現在のリモートfeatureにもたらすためにGitリポジトリを告げたということです分岐、おそらくマージ戦略を介して。 featureブランチを書き直したばかりなので、Gitはリモートブランチを少なくとも「マージ」さえすれば「新」として扱いました。いずれにしても、git pullを実行するのは間違っていました。必要なのは、機能ブランチを強制的にプッシュすることだけでした。

リバース・オーバー・マージを使用する理由が不思議であれば、リベースにはフィーチャー・ブランチの線形履歴を維持する能力があることが分かります。これは、ブランチの履歴を読みやすくするために有利です。欠点は、このブランチを使用しているすべての人がリベースすることでより多くの作業を行う必要があることです。

+0

素晴らしい!私はgit mergeをやりました - git pullをキャンセルするには。その後、私はgit push - force origin 2FAを実行しましたが、問題はありませんでした。ありがとう。 – rept

関連する問題