簡體   English   中英

如何解決此git合並沖突?

[英]How to resolve this git merge conflict?

我對解決合並沖突還很陌生。 在這種情況下我該怎么辦? 是否刪除了現有代碼,並用新的(和完全不同的)代碼替換了? 我是否只刪除HEAD和========之間的代碼? 還是這意味着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

基本上,這意味着HEAD=======之間的塊與=======>>>>>> origin/one-169之間的塊有顯着差異。 您將刪除HEAD=======>>>>>>> origin/one-169行,並刪除/移動所需的任何其余代碼。

發生這種情況的原因是,回購的頂端(或HEAD )與分支( one-169 )的區別在於git不能簡單地自動合並。 Git依靠您告訴它這兩個選項之間應該存在什么,包括保留兩者或不保留兩者。

一旦該文件達到應有的狀態,您將執行git add <file>然后git commit完成合並。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM