USING GIT IN XCODE
LOOKING AT HISTORY
Xcode provides a Versions editor, which has three different perspectives on the git history for a file. To use the Versions editor, select the file in the Standard editor in Xcode, the switch to the Versions editor using the editor segmented control in the upper right hand corner of the Xcode window.
Xcode提供一个历史编辑器,用来比对不同提交版本中修改的文件的。选择一个文件,然后选择图示中的标记。
The three perspectives are Comparison, Blame, and Log, and can be selected using the segmented control in the lower right portion of the editor pane when the Versions editor is active.
这3个标签分别是比较,责任制标签(谁修改了什么代码),以及日志,可以通过segmented control来选择不同的功能。
The Comparison view will initially show changes in the working copy from the most recent commit. Changes can be discarded by clicking on the number in the center column and selecting Discard Change from the menu. The Comparison view can also compare any two arbitrary commits. To do this, click the clock icon at the bottom of the center column. Xcode will present a view of the commits that have taken place for the file. Adjust the two white pointers to select the version to display in each window. Xcode will display the commit information for each commit as you move the arrow past it. Once selected, Xcode will highlight the code differences between the versions.
比较器可以显示当前项目中修改的文件与最近提交的文件的不同的地方。你可以把修改恢复到以前的状态当中。
If something in the code does not make sense or is not clear, it can be helpful to talk to the person who coded it. Blame view can identify the author of each line of code by showing who made each change in the file, and corresponding commit information for each change.
如果某些代码看起来意义不明,去和提交代码的人交流会很有帮助。责任标签view就是为了标记哪一行是哪个人修改的代码的。