My Xcode Is Showing Two Branches Open At Same Time In Source Control

- 1 answer

My xcode is showing two branches open at same time in source control. i want to remove one brance from that. because it was producing some uncommited changes when i switch branch. Screenshot is attached. Thanks for your help in advance. Additional details Xcoed Version : 7.1enter image description here



I had the same issue and found out how to remove the undesired branch under this environment : XCODE 7.3 (7D175) and use of CocoaPods generating '.xcworkspace' file.

Following the steps hereafter is the way to find and remove the branch : 1. Locate the 'MyApplication.xcworkspace' file. 2. Open this file with TextWrangler for instance (the following steps must be done in the chosen editor). 3. You should see two folders : 'xcshareddata' and 'xcuserdata'. Unfold 'xcshareddata'. 4. Select and open the 'MyApplication.xcsmblueprint' file.

Now, you should see some lines where the branch you want to remove is written. Note its ID in the 'DVTSourceControlWorkspaceBlueprintIdentifierKey' section and then select all the lines where it appears so as to delete them at the same time. These lines are located in kind of dictionaries.

Open your project in XCODE and you shouldn't see your undesired branch anymore in the 'Source Control' menu.

Added Explanation

@Muthu Selvam :

  1. In your '.xcscmblueprint' file, take a look at the titled dictionary "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" (line 12). You notice you have 3 Ids as keys and names as values. Here, it means you have 3 different branches apparently and two of them having the same name (weird ???).

  2. Now, if you take a look at the titled array of dictionaries "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" (line 20), each of your 3 branches is deeply described in a dedicated dictionary. That's here you see the one you want to keep and those you have to remove (look at the "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" in each dictionary).

  3. Once you have selected the IDs of the 2 branches you want to delete, take a look at the titled dictionary "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" (line 6) and remove the 2 undesired lines including the 2 undesired IDs.

  4. Same as step 3 in the titled dictionary "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" (line 12).

  5. Last but not least, remove the entire 2 dictionaries in the titled array "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" (line 20).

It should work. :o)