在Xcode上使用GIT

1.初始化GIT

(1)创建项目时,使用GIT:勾选Create git repository on (My Mac )

(2)创建项目之后,使用GIT:

cd path
git init
git add .
git commit -m 'Initial commit'

如果Source Control菜单下的命令不可用,重启Xcode。

注意:提交时,如果点击了忽略更改,Xcode会提示你是否同意。如果你同意忽略,这些被忽略的代码将会永远消失,无法再找回来。

2.提交修改:Source Control>commit

3.版本比较:View>Version Editor>Show version editor  或 (左:当前,右:之前)

查看提交作者:View > Version Editor > Show Blame View

4.分支

创建分支:Source Control > GitDemo-master > New Brance…

切换分支:Source Control > GitDemo –AnotherBranch > Switch to Branch…

合并分支:Source Control > GitDemo – master > Merge From Branch…

5.忽略修改:Source Control>Discard Changes in 2 Files

参考:在Xcode中使用Git进行源码版本控制

原文地址:https://www.cnblogs.com/guchunli/p/6402741.html