USING GIT IN XCODE
MAKING AND COMMITTING CHANGES
Once you have a working copy of your project, it’s time to get to work. As you make changes to the project, Xcode will indicate when files have been changed from the working copy.
当你成功的将项目复制到了本地,现在就可以干活了。当你更改了项目中的某些文件的时候,Xcode会直接指示出文件的修改情况。
An “M” next to a file indicates it has been modified, and an “A” indicates the file is new to the repository.
To commit changes, select File | Source Control | Commit from the Xcode menu. Xcode will display all the differences from the working copy in the commit view. If you only want to commit some of the changes, you can check or uncheck files as desired to include or exclude them from the commit. In addition, you can select only the files you want to commit before selecting File | Source Control | Commit from the Xcode menu, and only the files you have selected will be displayed in the commit view.
“M”标记这这个文件被修改了,“A”标记着新添加了一个文件到项目当中了。为了提交更改,打开File | Source Control | Commit from the Xcode menu。Xcode将会显示出更改的内容。如果你只想提交某些更改,你可以只提交某些修改过的文件。
In this example, I have added a label to the storyboard with a corresponding property in the view controller, and have added a new class to the project. I only want to commit the label changes, so I have selected those and added a commit message in the bottom section. In addition to making file level selections for a commit, Xcode can do line level selections for a commit.
在这个例子中,我给storyboard添加了一个属性并在对应文件中进行了一些修改。我只想提交这一个修改。所以我只选择了那个要提交的文件,剩下的Xcode会帮你处理好的。
In this example, I have work in progress in myExperimentalMethod, but I have added the desired functionality to myNewMethod and would like to commit so other members of the team can use it while I finish myExperimentalMethod. By clicking on the numbers in the center column I can select whether a change should be included in or excluded from the commit, or I can discard the change.
Note that Xcode will not show deleted files that have been removed from the project. When a file is deleted from an Xcode project, the project will indicate that the project has been modified, but the file will no longer be visible in the Xcode project view. The deleted file will be staged for the next commit and will be included in the next commit, but it will not be visible in the project view or the commit view.
在这个例子中,我正在修改myExperimentalMethod,我修改了一些代码后想提交给其他的人来使用,我可以只提交某些部分的修改给其他人使用。
注意,Xcode会显示已经从项目中移除了的文件。当一个文件从Xcode中被删除了,Xcode会标示出修改的信息,但是这个文件在项目中并不可见,这个被删除的文件会在下一次提交中显示出来,而不会在这次提交中显示出来。