繁体   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