2

I'm using Xcode 4's built-in Git functionality, and I am pushing my commits to a remote repository.

However, the code files are in one directory (~/users/me/projects/theproject) and the images are in a second, separate directory. (~/dropbox/projects/theproject). Xcode thus allows me to add, commit, and push files that I place in the first directory, but not in the second one. If I right-click one of files, then do Source Control -> Add, it's greyed out.

How can I add the files in the second directory in the remote repository? Is it possible to do it within Xcode? If not, what would be the git command?

1
  • please see my answer below about "creating a junction or hardlink" - this will allow you to do what you want. Commented Apr 9, 2014 at 20:37

2 Answers 2

1

Files in a single git repository need to be part of the same directory tree (that is, they all need to be located somewhere underneath the directory containing the .git directory). If you were to move your images from ~/dropbox/... into ~/users/me/projects/theproject, you would be able to add them to the repository.

Alternatively, you could create a separate repository inside your dropbox folder and use that just for the images.

Sign up to request clarification or add additional context in comments.

1 Comment

I can't move the files as there are hundreds of them and I would need to manually readd them to the target. Changing the git directory is possible to do from the command line (stackoverflow.com/questions/9797387/…) but I can't figure out the command...
1

I do this exact thing by creating a junction or hardlink (see below) to my "directory that's outside of the tree" so that it appears to be mounted inside the directory hierarchy where my .git folder/repo sits.

like so:

\(root of project)            <------ \real_images_folder
 |-- .git                     |   
 |-- htdocs                   |
 |-- images  <------junction---

see my answer here for details on how to create a junction: https://superuser.com/questions/455853/can-i-delete-the-the-folder-c-programdata-package-cache?answertab=active#tab-top

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.