XCode 源代码控制:查看一个文件的更改
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22146026/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
XCode source control: view changes for one file
提问by dariaa
Is it possible to view a "timeline" (history) for a selected file for like 50 commits? I mean changes made to this particular file and and view commits when they were made and users who changed them? I know Xcode got some powerful version control features, I just can not find this one.
是否可以查看所选文件的“时间线”(历史记录),例如 50 次提交?我的意思是对这个特定文件所做的更改,并查看提交时的提交以及更改它们的用户?我知道 Xcode 有一些强大的版本控制功能,我就是找不到这个功能。
回答by Peter Foti
What it sounds like you want is the "Blame View", if we were on the terminal you could write git blame <file-name>
to see the commit/time/and user for every single line of a particular file. In Xcode you can accomplish the same thing by activating the blame view. I've posted a picture to show you where the Blame View button resides. From there you should be all set.
听起来您想要的是“责备视图”,如果我们在终端上,您可以编写git blame <file-name>
以查看特定文件每一行的提交/时间/和用户。在 Xcode 中,您可以通过激活blame 视图来完成同样的事情。我已经张贴了一张图片来向您展示 Blame View 按钮所在的位置。从那里你应该一切准备就绪。
回答by AndyDeveloper
The commit history is in the Version Editor.
提交历史记录在版本编辑器中。
Select the file for which you want to see the commit history. Then go to View > Version Editor > Show Version Editor (or just select the Comparison view from the top-right toolbar icon - same place as the Blame view).
选择要查看其提交历史记录的文件。然后转到“查看”>“版本编辑器”>“显示版本编辑器”(或仅从右上角的工具栏图标中选择比较视图 - 与 Blame 视图相同的位置)。
Clicking on the commit label below the editor will reveal the history including dates.
单击编辑器下方的提交标签将显示包括日期在内的历史记录。
回答by Motti Shneor
Yes. Xcode's Comparison view is exactly for that. When you select a source file, and choose comparison view, you have a time-machine like user-interface that besides letting you compare any two versions of the file, will also present (when you hover) all the commits of the file with their descriptions. This UI opens when you click the clock button in the bottom between the two versions of the .
是的。Xcode 的比较视图正是为此而生。当您选择一个源文件并选择比较视图时,您将拥有一个类似于用户界面的时间机器,除了让您比较文件的任何两个版本外,还将显示(当您悬停时)文件的所有提交及其说明。当您单击两个版本的.
Pay attention, that Xcode will list all the commits, but will fail to show the content of versions of the file if the file-name or path changed. I think Xcode makers thought that because sources are considered "different" if they are named differently or located differently, there's no point in showing them. It may be, though that they just overlooked the --follow parameter to git.
请注意,Xcode 将列出所有提交,但如果文件名或路径更改,则无法显示文件版本的内容。我认为 Xcode 制造商认为,因为如果源名称不同或位置不同,则它们被认为是“不同的”,所以显示它们没有意义。可能是,尽管他们只是忽略了 git 的 --follow 参数。