how to fix this kind of git conflict: .merge

This question already has an answer here:

  • How to resolve merge conflicts in Git? 32 answers

  • You have to resolve a merge conflict, you have to decide which one you want to keep. Once you choose you can change the file, add and commit it.

    Looks like one of you wanted to add :

      @Inject
        TripPlannerOmnitureReporter reporter;
    
        private TripPlannerCardAdapter adapter;
    

    An the other one something else. If it was you then you can choose alone, if not then you should ask your teammate.


    Well, The lines above, are dividing the two different versions of your code. One of them is your changes, and the other one is the master (I assume) or other branch changes. When you merged, git couldn't resolve this automatically so now you have to decide and clean it up manually. You for sure want to keep this line "private TripPlannerAdapter adapter;" because it is in both commits.
    And this line @Inject TripPlannerOmnitureReporter reporter; you might as well keep it. If you wrote this line, I'm guessing you want it. If you didn't, then someone else did, and you probably want to have it as well. Try to build, and run and check if everything works!

    @Inject
    TripPlannerOmnitureReporter reporter;
    
    private TripPlannerCardAdapter adapter;
    

    Usually git make marks with <<<, =======, and >>>>>>> to point out where your code has a conflict. A conflict is a part of the code where more than one programmer changed at the same time and the version control could not figure out which it should keep.

    You just have to decide which part to keep and the one to delete.

    It seems to me, that you should delete between ====== and >>>>>>>. Including every line with the marks (<<<,======,>>>>>>>).

    Basically, keep the code:

    @Inject
    TripPlannerOmnitureReporter reporter;
    
    private TripPlannerCardAdapter adapter;
    
    链接地址: http://www.djcxy.com/p/7226.html

    上一篇: 由于冲突,Git合并失败

    下一篇: 如何解决这种git冲突:.merge