[灌水]测试贴3
Note from Ray: Tutorial Team member Felipe Laso Marsetti has ported this tutorial to iOS 7 as part of the iOS 7 feast
. We hope you enjoy!
Whether you’re a solo developer or working on a team, if you’re not using source control for your projects, you should be.
Source control is amazing because it helps you more easily revert to older version of your code, see how your code has changed over time, and work as a team. And one of the best source control systems is built right into Xcode – Git!
Git is a distributed version control system initially developed by Linus Torvalds, the principal force behind the development of the Linux kernel. The nice thing about Git is there doesn’t have to be any central repository – everyone can have their own view of the code, and pull in changes from other sources.
In this tutorial, you’ll get hands on experience with Git and learn how to use it directly inside Xcode, the command line, and even how to integrate your Xcode projects with Github, a popular online git repository. This tutorial is fully updated for iOS 7 and covers Git using Xcode 5.
So without further ado, let’s Git going!
Gitting StartedRather than ramble on about the theory of Git, you’re going to dive right in and try it out. You’ll create a new Xcode project and try out some typical tasks you will typically do on a day-to-day basis with Git source control.
So fire up Xcode and create a new Single View Application from the available templates.
Now, fill in the template options as follows:
[list] [*]Product Name : GitUseExample [*]Company identifier : As the name indicates, it’s your company identifier, if you have one. Otherwise, type whatever. [*]Class prefix : Leave this empty. [*]Device family : iPhone [/list]Now click Next. The following dialog allows you to choose where to save your project. Choose the location and make sure “Create git repository on My Mac” is selected before you click the create button. Once you do that, click the “Create” button.
By checking that, Xcode will create an empty Git repository and use the basis of your new project as your first commit. Well, that’s exactly what you want!
All 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. So think of a repository as a database for versions.
In the course of working on your project, you’ll add files, modify code, and change your project many times.
After you make a big set of changes and are in a “known good” state (typically one or more times per day), it’s a good idea to check in your changes back into the repository. This way, you have a record of “known good” states that you can always revert back to.
But what about the code that’s in your project already, that was created by the project template? Take a look at the following screen.
Your project is still blank, and since you didn’t make changes yet, you don’t need to commit. But, basically, Xcode has added and committed several files when you created your project. That commit is the initial commit performed automatically by Xcode :]
To check that, click the Source Control menu item and select History… .
In the drop down window, notice there’s a commit along with some information about it like the commit hash, date and time, person who made the commit, files change, and commit message.
If you click on the text that says “Show 18 modified files” a new pane will drop down containing information about all of the files that were committed, as well as what was changed in each one.
Now, try to make some changes within your files. For example, open upAppDelegate.m and change application:didFinishLaunchingWithOptions: to the following:
After you save the file, you will note that AppDelegate.m now has a “M” badge next to the filename:
[color=rgb(51, 51, 51)]The “M” badge stands for “modified.” Specif
. We hope you enjoy!
Whether you’re a solo developer or working on a team, if you’re not using source control for your projects, you should be.
Source control is amazing because it helps you more easily revert to older version of your code, see how your code has changed over time, and work as a team. And one of the best source control systems is built right into Xcode – Git!
Git is a distributed version control system initially developed by Linus Torvalds, the principal force behind the development of the Linux kernel. The nice thing about Git is there doesn’t have to be any central repository – everyone can have their own view of the code, and pull in changes from other sources.
In this tutorial, you’ll get hands on experience with Git and learn how to use it directly inside Xcode, the command line, and even how to integrate your Xcode projects with Github, a popular online git repository. This tutorial is fully updated for iOS 7 and covers Git using Xcode 5.
So without further ado, let’s Git going!
Gitting StartedRather than ramble on about the theory of Git, you’re going to dive right in and try it out. You’ll create a new Xcode project and try out some typical tasks you will typically do on a day-to-day basis with Git source control.
So fire up Xcode and create a new Single View Application from the available templates.
Now, fill in the template options as follows:
[list] [*]Product Name : GitUseExample [*]Company identifier : As the name indicates, it’s your company identifier, if you have one. Otherwise, type whatever. [*]Class prefix : Leave this empty. [*]Device family : iPhone [/list]Now click Next. The following dialog allows you to choose where to save your project. Choose the location and make sure “Create git repository on My Mac” is selected before you click the create button. Once you do that, click the “Create” button.
By checking that, Xcode will create an empty Git repository and use the basis of your new project as your first commit. Well, that’s exactly what you want!
All 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. So think of a repository as a database for versions.
In the course of working on your project, you’ll add files, modify code, and change your project many times.
After you make a big set of changes and are in a “known good” state (typically one or more times per day), it’s a good idea to check in your changes back into the repository. This way, you have a record of “known good” states that you can always revert back to.
But what about the code that’s in your project already, that was created by the project template? Take a look at the following screen.
Your project is still blank, and since you didn’t make changes yet, you don’t need to commit. But, basically, Xcode has added and committed several files when you created your project. That commit is the initial commit performed automatically by Xcode :]
To check that, click the Source Control menu item and select History… .
In the drop down window, notice there’s a commit along with some information about it like the commit hash, date and time, person who made the commit, files change, and commit message.
If you click on the text that says “Show 18 modified files” a new pane will drop down containing information about all of the files that were committed, as well as what was changed in each one.
Now, try to make some changes within your files. For example, open upAppDelegate.m and change application:didFinishLaunchingWithOptions: to the following:
- ( BOOL ) application: ( UIApplication * ) application didFinishLaunchingWithOptions: ( NSDictionary * ) launchOptions{ // Override point for customization after application launch. NSLog( @ " application did finish launching" ); return YES;} |
After you save the file, you will note that AppDelegate.m now has a “M” badge next to the filename:
[color=rgb(51, 51, 51)]The “M” badge stands for “modified.” Specif
发表于:2016-06-22 07:00只看该作者
2楼
3楼
啊
韬客社区www.talkfx.co
发表于:2016-06-22 07:24只看该作者
4楼
MD,刷積分
第二階跨第三階中。。。(2024)又五年过去了,才知道自己还没有进入第二阶
5楼
koumyou 发表于 2016-06-22 03:49
MD,刷積分
韬客社区www.talkfx.co
6楼
韬客社区www.talkfx.co
7楼
圣光万岁 发表于 2016-06-22 03:28
这是测试帖,看帖子名称
韬客社区www.talkfx.co
发表于:2016-06-22 07:48只看该作者
8楼
d
韬客社区www.talkfx.co
发表于:2016-06-22 07:48只看该作者
9楼
sj
韬客社区www.talkfx.co
11楼
韬客社区www.talkfx.co
12楼
韬客社区www.talkfx.co
14楼
韬客社区www.talkfx.co
15楼
发表于:2016-06-22 13:33只看该作者
16楼
17楼
额
韬客社区www.talkfx.co
18楼
才
韬客社区www.talkfx.co
19楼
八十
韬客社区www.talkfx.co
20楼
韬客社区www.talkfx.co