#GIT ON MAC XCODE CODE#
Open AppDelegate.Use commands in the Source Control menu to manage your project files with a source code repository. Click on the master branch, then click the Initial commit in the editor window and you will see the details of Xcode’s automatic commit. Option-click the disclosure triangle next to GitUseExample in the left pane to reveal all of the Branches, Tags and Remotes configured in your repository.
Now, make sure the Source Control inspector ( Command-Option-3) is open as well. To check that, open the Source Control navigator ( Command-2 is the keyboard shortcut). There is nothing yet for you to commit because Xcode did it for you when you created your project. Your project still contains only the template files. This gives you a record of “known good” states that you can always return to.īut what about the code that was created by the project template? In the course of working on your project, you’ll add files, modify code, and change your project many times.Īfter you make a big set of changes and your project is in a “known good” state (typically one or more times per day), it’s a good idea to check your changes into the repository. Think of a repository as a database for versions. Xcode will create your new project along with a new Git repository.Īll source control systems, including Git, store their data into a repository so that they can manage your project versions and keep track of changes throughout the development cycle. Note: If you don’t see the checkbox, click the Options button. Choose a location and make sure Create git repository on My Mac is selected before proceeding. The following dialog allows you to choose where to save your project. Use Core Data, Include Unit Tests, and Include UI Tests: not checked.Organization identifier: As the name indicates, it’s your organization’s identifier, if you have one.Team: Your Apple Developer team if you have one, or None.You’ll create a new Xcode project and try some tasks that you will typically do on a day-to-day basis with Git source control.įire up Xcode and create a new Single View Application project. Rather than ramble on about the theory of Git, you’re going to dive right in and try it out.
#GIT ON MAC XCODE HOW TO#
In this tutorial, you’ll get hands on experience with Git and learn how to use it directly inside Xcode. The nice thing about Git is there doesn’t have to be any central repository – everyone can have his or her own view of the code, and pull in changes from other sources. Git is a distributed version control system initially developed by Linus Torvalds, the principal force behind the development of the Linux kernel. And one of the best source control systems is built right into Xcode – Git! Source control is amazing because it helps you more easily revert to older versions of your code, add new features without risk to your working app, see how your code has changed over time, and work as a team. Whether you’re a solo developer or working on a team, if you’re not using source control for your projects, you should be. Original tutorial by Malek Trablesi and previously updated by Felipe Laso-Marsetti.
#GIT ON MAC XCODE UPDATE#
Update note: Updated for Xcode 9 by Richard Critz.