Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode git showing multiple repositories

I'm working on multiple projects in xcode all are hosted on GIT with each having separte repository and multiple braches. In one of my project it is showing multiple repository. This case occurs while taking pull/push/discard changes.

enter image description here

This is the case. I need to uncheck the other one to pull/push/discard in current project. I've tried checking out new project too. But no success. How can I remove the other project here?

PS: It's only occurring in one of my project while others are working fine.

like image 618
Rohitax Rajguru Avatar asked Apr 25 '19 05:04

Rohitax Rajguru


People also ask

Can a Git project have multiple repositories?

If you are working on a big project, then it is inevitable that you need to work with multiple repositories. That's why you need to sync your local code base with multiple Git remote repositories.

How do I combine repositories?

To combine two separate Git repositories into one, add the repository to merge in as a remote to the repository to merge into. Then, combine their histories by merging while using the --allow-unrelated-histories command line option.

Can a repository have multiple repositories?

With Git, using multiple repositories is the only way to work efficiently. This enables each team to work independently, and do their work faster. You can also make sure that developers only have access to the repositories they need access to (thus making Git more secure.)

How do I change my Xcode repository?

Get changes from the remote repository by choosing Source Control > Pull. In the dialog that appears, select the branch with the changes you want to apply to your local repository, select the “Rebase local changes onto upstream changes” option if you want, and click Pull.


1 Answers

I got stuck into the same issue while working on multiple projects in Xcode. This happens when we add files from another project and therefore the Xcode starts showing repository of other project also. The files are not exactly copied in the new project but only reference is added.

To fix this issue lets assume you have added files from project named "Project-old" to project named "Project-new". And Project-new is showing multiple repositories. Now, do the following steps:

  1. First you need to identify files which are added from Project-old. Easiest way is to rename the Project-old folder temporarily to "Project-old-check". Now open Project-new. you will see the red highlighted files in Xcode project navigator.
  2. Select the highlighted file and update the path of file from File inspector. You may need to copy this file from Project-old to Project-new manually with Finder.
  3. Repeat this process for all other red highlighted files and close Xcode.
  4. Relaunch Xcode and Open project by double clicking .xcodeproj or .xcworkspace file. Do not open project from Xcode welcome screen or recent files.
  5. Try pushing now. you will see only one repository now.

You can rename "Project-old-check" back to "Project-old" now.

Hopefully this will help someone.

like image 70
Nabeel Avatar answered Oct 16 '22 20:10

Nabeel