简体   繁体   English

如何解决此git合并冲突?

[英]How to resolve this git merge conflict?

I am fairly new to resolving merge conflicts. 我对解决合并冲突还很陌生。 What should I do in this case? 在这种情况下我该怎么办? Did the existing code get removed and the new (and very different) code replace it? 是否删除了现有代码,并用新的(和完全不同的)代码替换了? Do I just delete the code between HEAD and ======== ? 我是否只删除HEAD和========之间的代码? Or does this mean that HEAD has a new describe block (pool_availability_bv_callback) that I need along with the new describe "#moved" block in my code? 还是这意味着HEAD在我的代码中具有我需要的新描述块(pool_availability_bv_callback)和新的描述“ #moved”块?

2315 <<<<<<< HEAD
2316   describe 'pool_availability_bv_callback' do
2317     it 'should be invoked during reservation creation' do
2318       PoolAvailabilityBv.should_receive(:calculate_for).once
2319
2320       res = build(:reservation)
2321       res.save!
2322     end
2323
2324     it 'should be invoked during reservation edit' do
2325       res = create(:reservation)
2326
2327       PoolAvailabilityBv.should_receive(:calculate_for).once
2328       reservation.cancel_date = Time.zone.now
2329       res.save!
2330 =======
2331   describe "#moved" do
2332     let!(:vehicle) { create(:vehicle, :in_pool, :with_vehicle_type) }
2333     let!(:reservation) { create(:reservation, pool: vehicle.pool) }
2334
2335     it "should return true if the reservation's vehicle have been moved out if its pool" do
2336       VehiclePoolMap.delete_all # remove all vehicles from pools
2337       expect(reservation.moved?).to be_true
2338     end
2339
2340     it "should return false if the reservation's vehicle has not been moved out if its pool" do
2341       expect(reservation.moved?).to be_false
2342 >>>>>>> origin/one-169

Basically it means that the block between HEAD and ======= differs dramatically than that of what's between ======= and >>>>>> origin/one-169 . 基本上,这意味着HEAD=======之间的块与=======>>>>>> origin/one-169之间的块有显着差异。 You'll remove the HEAD , ======= and >>>>>>> origin/one-169 lines and delete / move around whatever remaining code you want. 您将删除HEAD=======>>>>>>> origin/one-169行,并删除/移动所需的任何其余代码。

This happened because what's at the tip (or HEAD ) of your repo differs in such a way from your branch ( one-169 ) that git can't simply auto-merge this. 发生这种情况的原因是,回购的顶端(或HEAD )与分支( one-169 )的区别在于git不能简单地自动合并。 Git is relying on you to tell it what should be there between those two options, including keeping both or neither. Git依靠您告诉它这两个选项之间应该存在什么,包括保留两者或不保留两者。

Once this file is the way it should be, you'll do git add <file> then git commit to finish the merge. 一旦该文件达到应有的状态,您将执行git add <file>然后git commit完成合并。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM