pulling an older version of a git repo to xcode - xcode

I am trying to get started editing an ios app that is stored on a bitbucket repo. The most recent version of the app crashes with a message:
[Crashlytics] Version 3.3.4 (82)
fatal error: unexpectedly found nil while unwrapping an Optional value
(lldb)
So, I am trying to pull an older version of the app.
I click "Check out an existing project" Then it prompts for me to enter the location of repository. I have no problem pulling and running the most recent version from the repo. Is there some way to specify that I do not want it to use the most recent version?
EDIT 1
The window I am working with looks almost exactly like this: http://www.techotopia.com/images/6/68/Xcode_6_add_git_repository_dialog.png

Do the Check Out first - just go ahead and check out the project repo. (You may already have done this.)
Now you have, on your computer, the whole repo, including earlier commits (versions) of the project. In other words, you didn't just check out; you cloned.
Now use Log View to find the commit you think will work.
Now check out that commit. You'll have to use the command line or Source Tree to do that; Xcode's weenie source control support won't help you with it.

Related

Open old version of Xcode project files stored in GitLab

I am trying to figure out how to open an old version of my Xcode project that is stored in GitLab. Usually, I use Xcode to push updates to Gitlab and on the occasions, I've had to get my project from GitLab, I simply click the "Open in Xcode" button on GitLab, which brings my project up.
The problem that I'm having now is that I've accidentally introduced a bug into the project that crashes the app and I can't figure out how to crush this bug. The last couple of updates to GitLab contain this bug so I need to revert to a copy a bit in the past. When I click on this update, there is no open in Xcode button, and I'm unsure about how to open this previous version.
I'm hoping that there is a straightforward solution to getting this old version of this file up. I'm just getting started using git, and I'm hoping someone on here can provide some insight.
Can someone please point me in the right direction on the easiest way to revert to an old project update on GitLab?
It seems easier to:
close XCode
cd /path/to/local/clone/of/GitLab/repo
switch to the command line and type git switch <old SHA1> in order to update the working tree with the files content of that past SHA1
open XCode back up.
(Note: git switch is better than the old legacy git checkout command)
If you want to commit some fixes, your git switch command will be:
git switch -c fix <old SHA1>
That will start a fix branch starting from <old SHA1>.

Can't pull on Xcode Source Control (Repository is Locked)

Me and my teammates are having a hard time trying to fix an issue with source control and we don't know how to fix it.
What happened:
I had to change the bundle identifier to be able to build on a phone
I had to change the .plist file for google Firebase because of the bundle id change
I made a commit and pushed the project to our repository in Bitbucket and pushed it
Now when they try to pull the latest change they all get the files but with merge issues (That don't reflect on the source control screen) and when you check on the log it doesn't show that they were able to pull the commit (even though they got the files and all the files even have the head and MASTER text that shows up when you have merge issues). The error we keep getting is
"The repository is locked."
"Make sure any other operations on the repository are finished and try again. "
I tried checking the other questions but the same error only shows up for users that can't commit because the repository is locked. Not while pulling.

Why does creating new branches in Xcode9 always fail with "not a valid branch name"?

Whenever I try to create a new branch, it says: The name "MY-BRANCH-NAME" is not a valid branch name. I am adding the steps I performed while trying to create a new branch.
Why is this happening?
P.s.- There are no uncommitted changes and everything is pushed to github repository.
I have the same problem. Looks like an xcode bug.
xcode Version 9.0 beta 3 (9M174d)
I exited xcode, ran up sourcetree and created the new branch, loaded up xcode again and all appears fine.
I also replicated the issue with a brand new spritekit game project.
Raised a bug report with apple:
https://bugreport.apple.com/web/?problemID=33497210
Could be an issue with your git UI? are you able to get the command line working. simply type in: "git checkout -b new-branch-name" and it should work unless you include some illegal characters in there. The cause is more than likely a bug in the particular UI of git application that you are using.

Source Control on already existing project Xcode

I've read that developers really need source control. Now I never used it before and I'm a bit lost with my existing projects.
How do I setup it?
There's already a File path inside of it, but it goes to nothing? I don't even know what it does in there.. I want a local git for my own. I found how to set it up with Terminal. But I think there should be a right way on doing this with Xcode and not with Terminal?
I'm sorry to say that Xcode does not have an option to place an existing project under version control. You can however use GitHub for Mac which will allow you to do this. It also has convenient merging tools and lets you push your code to GitHub.com if you like, all at the touch of a button: https://mac.github.com
It's easy enough to create a git repo from the command line though: open Terminal and navigate to the root folder of your project. Then type the following:
git init
git add .
git commit -m "initial commit"
Note that this approach as well as GitHub for Mac will version control every file in your project - which is not what Xcode does when you start a new project with Git enabled. You may run into trouble because your user interface state changes once every second - which can make committing and merging difficult.
The following article discusses this in detail:
http://pinkstone.co.uk/how-to-place-an-exiting-xcode-project-under-version-control-with-git-and-ignore-files-you-dont-want-to-track/

Cannot get Xcode SCM to work with Gitolite based server

For whatever reason, I cannot get the built-in source control tools in Xcode 4.1 to work with the git repository I have setup on my server. The server is setup to use Gitolite.
Everything works fine from the command line. I can add the remote, push, pull, and then clone out again. I can also access Github in Xcode just fine.
Has anyone been successful getting these two tools to work together?
Any idea how I can debug this (I have no idea what Xcode is doing behind the scenes)?
The only thing that has stood out to me is that Xcode wants to include a top-level folder when accessing the repository, i.e.: git#my-server.com:folder/repository-name.git and Gitolite doesn't want you to do that. It wants: git#my-server.com:repository-name.git
I have a Gitolite 2.0.3 server running on Ubuntu 11.10, and I am able to use with the built-in SCM integration in Xcode 4.2 running on Snow Leopard.
To see log information about commits and other SCM operations, go to the Xcode log navigator (speech bubble icon in the left column, or select View > Navigators > Show Log Navigator, or press Cmd-9). The log navigator has filters to show only error messages. That should give you more information about what's going on.
One thing that stands out for me in your question is that when using Gitolite, I never use the .git suffix on the client went entering the git URI. Try omitting that and see if that makes any difference when working in Xcode. For example, I have git repositories on the server in folders like ~gitolite/repositories/project1.git or ~gitolite/repositories/apps/ios/project2.git, but when I am on the client, the git URIs look like: ssh://gitolite#myserver.com:12345/project1, or ssh://gitolite#myserver.com:12345/apps/ios/project2.

Resources