Hi, I have an Xcode project where I added the library RestKit as a sub-directory of my project. The issue I'm seeing is that SourceTree will not recongize the new directory at all in my working copy. Do you guys have any thoughts on why this would happen?
For what its worth, I just experienced the same issue on my machine. I dragged & dropped a folder that contained some .h and .m files, plus a Readme.md file into my Xcode project (using Finder), then added the files to my project (within Xcode).
SourceTree was completely unaware of any file inside the sub-folder that I had added. This could have caused a serious issue for me, as I thought all my files were committed to the index and pushed to GitHub. I only discovered the problem after deleting and re-cloning my repo (which I did for an unrelated reason).
I tried the usual CMD+R, changing the UI to Show All, Show Uncommitted, etc, but nothing worked. I verified that my .gitignore had nothing even remotely close to the files/folder that I had added.
The one thing I will say is that the folder I copied in was originally setup as a separate repository in SourceTree. Is it possible that SourceTree thought the files were part of a sub-module/sub-repository, and tried to "helpfully" prevent them from being added to the index?
Yes, if you have a .git folder in any subfolder, git will totally ignore it because it considers that whole tree to be a nested repository that looks after its own files. This isn't a SourceTree feature, this is something git always does when you use 'git status' (and hg does the same FWIW).
So if you copy files around that you intend to add to a repo (rather than as a submodule), it's really important not to copy any .git or .hg folders with it. Can be tricky I know, since Finder doesn't show them by default and will implicitly take them if you copy the parent folder.
This is what solved it for me. I had buried .git files inside folders which I dragged-in. After doing "ls -la" to show all files, and doing "rm -rf .git" on the unneeded git files (those inside the sub-folder, not the main .git file on the repository top level), all the new files and folders are now tracked.
This should only happen if there are no files inside the folder, or if every file was ignored by either your global ignore file, or the local ignore file.
You can use Cmd-R to force a refresh if you want to make sure that's happened, but if not it'll be that. You can check what ignored files there are in a repository by switching the file filter to 'Show Ignored' (it defaults to 'Show Pending', which includes unknown files so long as they're not ignored).
Ok, I have verified you guys have a bug. What I did to resolve my problem was I completely emptied the RestKit folder, then I created a simple TXT file called "readme.txt" and added it into the RestKit folder. When I did that then SourceTree started to see the RestKit directory. I then re-added all of the RestKit files back into that folder, and SourceTree saw those files as it should have done in the first place. I think there may be a logical error in the process that checks directories for files. Purhaps you guys need to take a look at that.
I tried a cmd-R refresh, and I also looked at the show ignored, but the RestKit folder isn't showing up anywhere. The RestKit folder has several sub-directories and an Xcode project file in it. I did noticed a similar issue earlier this morning when trying to add in a folder that contained two sub-folders. The sub-folders did have files, but nothing ever showed up in SourceTree. I think you guys have a bug.
I've just run a test here in both Mercurial and Git:
The result is an auto-refresh and a new untracked file 'testfile.txt' shows up in the folder 'folder1/folder2'.
I really do think you must have something in your ignore files which is causing this, because I can't replicate your issue here. I also use XCode projects regularly - they just look like regular folders to SourceTree, just like they do to git/hg and the terminal.
Sorry, you replied while I had the page open so we overlapped.
Here's the thing - the untracked files are reported by 'git status' or 'hg status', they're not at any time queried manually by SourceTree (if we did it ourselves we have to replicate the ignore behaviour). So there's no filtering or iteration in SourceTree to fix.
I re-ran my test with a copy of RestKit instead of creating folders myself. It worked perfectly when I moved or copied the RestKit folder in, here's the video: http://www.screencast.com/t/5XPXWCNpm
So, I can't replicate this behaviour.
Badges are a great way to show off community activity, whether you’re a newbie or a Champion.Learn more
Supported Platforms macOS Windows To make using Sourcetree as simple yet powerful as possible we embed (bundle) dependencies such as Git, Git LFS, and Mercurial. We strive to keep these...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG