简体   繁体   中英

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 ======== ? 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?

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 . You'll remove the HEAD , ======= and >>>>>>> origin/one-169 lines and delete / move around whatever remaining code you want.

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. Git is relying on you to tell it what should be there between those two options, including keeping both or neither.

Once this file is the way it should be, you'll do git add <file> then git commit to finish the merge.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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