如何解决这个git合并冲突?

时间:2013-11-27 16:13:54

标签: git rspec git-merge

我是解决合并冲突的新手。 在这种情况下我该怎么办?现有代码是否被删除,新的(和非常不同的)代码取代了它?我只是删除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

1 个答案:

答案 0 :(得分:2)

基本上,这意味着HEAD=======之间的块与=======>>>>>> origin/one-169之间的块明显不同。您将删除HEAD=======>>>>>>> origin/one-169行并删除/移动您想要的任何剩余代码。

之所以发生这种情况,是因为您的回购提示(或HEAD)与您的分支(one-169)的区别在于git不能简单地自动合并它。 Git依靠你来告诉它这两个选项之间应该存在什么,包括保持两者或两者都没有。

一旦这个文件应该是这样的,你将git add <file>然后git commit完成合并。

相关问题