How do I fix a Git merge with conflicts in breakpoint's file?

[亡魂溺海] 提交于 2021-02-07 20:43:31

问题


I have an iPad app (XCode 5, iOS 7, Git source control and Storyboards). I have two (2) branches I'm currently working on (1.8.1 in the App Store, and 2.0.0 as the working copy).

I made a slight change to 1.8.1 for the next release and thought XCode's source control would automatically merge the changes into 2.0.0. I guess I was wrong. So I attempted to do the merge using XCode's source control, and that's where things went downhill... it went into a loop. So, I killed XCode, and restarted it.

Now, I am attempting to do the merge using SourceTree. It tells me I have a merge conflict in my working copy which is (2.0.0). Looking at a build of 2.0.0, I see this:

      <BreakpointProxy
     BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
     <BreakpointContent
        shouldBeEnabled = "No"
        ignoreCount = "0"
        continueAfterRunningActions = "No"
        filePath = "saori/CalendarViewController.m"
        timestampString = "404851038.443273"
<<<<<<< HEAD                              <---------------- merge conflict
        startingColumnNumber = "9223372036854775807"
        endingColumnNumber = "9223372036854775807"
        startingLineNumber = "205"
        endingLineNumber = "205"
        landmarkName = "-viewDidLoad"
=======
        startingColumnNumber = "9223372036854775807"
        endingColumnNumber = "9223372036854775807"
        startingLineNumber = "205"
        endingLineNumber = "205"
        landmarkName = "-viewDidLoad"
        landmarkType = "5">
     </BreakpointContent>
  </BreakpointProxy>
  <BreakpointProxy
     BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
     <BreakpointContent
        shouldBeEnabled = "No"
        ignoreCount = "0"
        continueAfterRunningActions = "No"
        filePath = "saori/SubViewData.m"
        timestampString = "406167919.038573"
        startingColumnNumber = "9223372036854775807"
        endingColumnNumber = "9223372036854775807"
        startingLineNumber = "221"
        endingLineNumber = "221"
        landmarkName = "-drawRect:"
>>>>>>> 1.8.1
        landmarkType = "5">
     </BreakpointContent>
  </BreakpointProxy>
  <BreakpointProxy
     BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
     <BreakpointContent
        shouldBeEnabled = "Yes"
        ignoreCount = "0"
        continueAfterRunningActions = "No"
<<<<<<< HEAD                                    <------- merge conflict
        filePath = "saori/SubViewData.m"
        timestampString = "406167919.038573"
        startingColumnNumber = "9223372036854775807"
        endingColumnNumber = "9223372036854775807"
        startingLineNumber = "221"
        endingLineNumber = "221"
        landmarkName = "-drawRect:"
=======

UPDATE When I do a git status, I get the following:

# On branch 2.0.0
# You have unmerged paths.
#   (fix conflicts and run "git commit")   
# 
# Changes to be committed:
#
#   new file:   Resized Images/MainStoryboard.strings
#   modified:   saori/AppDelegate.h
#   modified:   saori/AppDelegate.m
#
# Unmerged paths:
#   (use "git add <file>..." to mark resolution)
#
#   both modified:      SalonBook.xcodeproj/project.xcworkspace/xcuserdata/rolfmarsh.xcuserdatad/UserInterfaceState.xcuserstate
#   both modified:      SalonBook.xcodeproj/xcuserdata/rolfmarsh.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   Crashlytics.framework/Versions/Current
#   SalonBook.xcodeproj/xcuserdata/rolfmarsh.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist.BACKUP.5744.xcbkptlist
#   SalonBook.xcodeproj/xcuserdata/rolfmarsh.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist.BASE.5744.xcbkptlist
#   SalonBook.xcodeproj/xcuserdata/rolfmarsh.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist.LOCAL.5744.xcbkptlist
#   SalonBook.xcodeproj/xcuserdata/rolfmarsh.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist.REMOTE.5744.xcbkptlist

My question is: how do I fix this so I can do the merge?


回答1:


Use .gitignore to exclude breakpoints data from your project (see Which Xcode project files can I 'exclude' from my git repo?).

You will then need to clear all files that are included in .gitignore from the git index (cache) using git rm -r --cached

git rm -r --cached .
git add .
git commit -m 'Removed all files that are in the .gitignore'
git push 



回答2:


to fix this:(mac)

  1. add gitignore file:

    • open the folder of your project from the terminal and press $ touch .gitignore
    • then press the command: $ vi .gitignore
    • press on the letter: i
    • add in each row the ignore text for example: PushFor.xcworkspace/xcuserdata/ tapaway.xcworkspace/xcuserdata/dang.xcuserdatad/UserInterfaceState.xcuserstate tapaway.xcworkspace/xcuserdata/dang.xcuserdatad/xcdebugger/ tapaway.xcworkspace/xcuserdata/ Pods/Pods.xcodeproj/xcuserdata/
    • press on the escape button on your keyboard
    • press $ :x (to save it)
    • to check everything is ok on your terminal: $ cat .gitignore
  2. now press the command: $ git st and see that you still have untracked files despite you just put them on gitignore, so that means you push it already to git so to fix it: -git --cashed (and copy the files here ) for example: git rm --cached Pods/Pods.xcodeproj/xcuserdata/dang.xcuserdatad/xcschemes/xcschememanagement.plist

now commit and push!



来源:https://stackoverflow.com/questions/20010722/how-do-i-fix-a-git-merge-with-conflicts-in-breakpoints-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!