Today when I tried to merge one of my branch say phuddu to my master, I got some weired messages from git.
...
ERROR: Merge conflict in app/models/activity.rb
Auto-merging app/models/death_report.rb
...
fatal: merge program failed
Automatic merge failed; fix conflicts and then commit the result.
Looks like I crashed into a merge conflict today.
My app/models/activities.rb file looked like following.
<<<<<<< .merge_file_sdfPaP
# == Schema Info
=======
# == Schema Information
>>>>>>> .merge_file_LT3vRO
# Schema version: 20090530092020
#
# Table name: activities
#
<<<<<<< .merge_file_sdfPaP
# id :integer(4) not null, primary key
# item_id :integer(4) not null
# user_id :integer(4) not null
# item_type :string(255) not null, default("")
# created_at :datetime
# updated_at :datetime
#
=======
# id :integer(11) not null, primary key
# user_id :integer(11) not null
# item_id :integer(11) not null
# item_type :string(255) not null
# created_at :datetime # updated_at :datetime
#
>>>>>>> .merge_file_LT3vRO
Every chunk of code above within the
<<<<<<<
and =======
reflects the modifications made by other commiter (Oh! why!! why did you do this?) whereas the code within the =======
and >>>>>>>
reflects the changes made by me. Now to resolve above conflicts we will edit our files according to the need and do the following.git update-index <filename>
It actually tells the git that conflicts have been resolved in the files. Now just do a commit and you are done.
1 comment:
Thanks for the update-index!! Saved my life.. wasn't able to add or commit and some other tutorials just doesn't point say anything about the update-index.
Post a Comment