- Swift 2 Blueprints
- Cecil Costa
- 652字
- 2021-07-09 21:36:41
Versioning your project
Every project should have a version control system, even if you are the only developer. Xcode works with Git as a default VCS, which has a special way of working.
Firstly, you have to know that Xcode offers you just the basic usage of Git; there are times when you might need to use the command line.
You can use Git in two ways: locally only or remote and locally. The first one is usually done by single developers and can be done very easily by checking this option when you have to select a folder for your new project. The following screenshot shows the option that needs to be checked in the file dialog:

The second way of working with Git is to use it remotely and locally. What does it mean? It means that you can create versions of your code locally and when you think that it is ready to be shared with the other members of the team, you can send it to the server. To do so, you have to configure a server by yourself or you can use this service from a third-party company, such as GitHub or BitBucket.
Note
Recently, Apple announced the Xcode server, where you can configure your Git server and also a continuous integration system. Explaining how to configure this server can be very exhausting and is out of the scope of this book. However, if you would like to create your own server, you can have a look at this possibility.
As a developer what you need to work with a remote repository is its URL. You have to request it to the system administrator or you can copy it from the website where you created it. GitHub, for example, shows it on the right-hand side with a button to copy the URL on the clipboard, as you can see in the following screenshot:

Once you have the URL, you can check it out by selecting the Check out an existing project option on the start up screen, as shown in the following screenshot. Or, you can click on the Source Control menu and select the Check out... option.

Once you have your project checked out and have started working on it, it doesn't matter whether it was created from a server or locally only. You will notice that when a file is modified, letter M will appear next to your file name on the project navigator. Letter A will also appear when a new file is added to the project. The next screenshot shows a sample of some files that were added or modified:

Note that letter M can also appear next to your project; it means that something in the project.pbxproj
file, which is inside of your project package. This file contains the information of your project like the source code files with their path and the settings; hence, you have to deliver it every time you add a file or change any setting.
To commit the modified and new files, you just need to use the command + option + C key combination. A dialog asking for a description of the modifications will appear, leave a message in a way that another developer understands what was done.
These commits are done locally by default. It means that only your computer knows about your modifications. If you want to send your commits to the server, don't forget to check the option that is under the comment box, as it is demonstrated in the next screenshot:

The other way around, which means receiving updates from the server, is called pull. To do a pull from the server, you just need to press the command + option + X combination key.
- Cocos2D-X權威指南(第2版)
- ASP.NET動態網頁設計教程(第三版)
- TypeScript圖形渲染實戰:基于WebGL的3D架構與實現
- C語言從入門到精通(第4版)
- Android開發案例教程與項目實戰(在線實驗+在線自測)
- Python High Performance Programming
- Visual Studio 2015高級編程(第6版)
- C# and .NET Core Test Driven Development
- C++ System Programming Cookbook
- WCF全面解析
- 深入大型數據集:并行與分布化Python代碼
- Ubuntu Server Cookbook
- 可視化H5頁面設計與制作:Mugeda標準教程
- Spring Boot 2+Thymeleaf企業應用實戰
- 編譯原理學習與實踐指導