Git命令行和Xcode结合使用(我来告诉你这行代码谁写的)


现在一直使用Git来管理代码,对于有强迫症的我来说,依旧选择了命令行,下面这段话可以更好的解释我为什么喜欢使用终端敲命令。

There are a lot of different ways to use Git. There are the original command line tools, and there are many graphical user interfaces of varying capabilities. For this book, we will be using Git on the command line. For one, the command line is the only place you can run all Git commands – most of the GUIs only implement some subset of Git functionality for simplicity. If you know how to run the command line version, you can probably also figure out how to run the GUI version, while the opposite is not necessarily true. Also, while your choice of graphical client is a matter of personal taste, all users will have the command-line tools installed and available.


但是发现在Terminal查看文件修改的内容并不是很方便,后来就结合Xcode本身已经集成Git相关功能的界面,来轻松的查看代码的修改信息。下面举几个例子来和大家一块学习。


用法一

Source Control --> History... --> 历史修改信息(界面见下图) --> 选择想要查看的某次修改(Show modified files) --> 被修改的代码一目了然


用法二

看到某块代码突然想看修改记录和代码修改人(好比一段很牛掰"垃圾"的代码,想知道谁写的) 右键 --> Show Blame for Line --> Open in Blame / Open in Comparison --> 效果如下


用法三

View --> Version Editor --> Show Log View ///等其他,下图所示

原文地址:https://www.cnblogs.com/chao8888/p/6722628.html