您的位置:首页 > 其它

菜鸟在Xcode中使用Git进行源码版本控制小记

2016-09-11 17:49 453 查看

创建Git源

打开Xcode,创建一个新的工程,在创建工程的最后一步勾选Create Git repository on **,即如图:



打开项目所存储的目录,在目录中有.git的子目录



添加Git源

如果你在项目创建时未创建git源,之后又想加上这个功能怎么办呢?下面就为大家讲解一下

完全退出Xcode,并打开终端

切换到该项目的目录下:cd /Desktop/getpost

初始化空的源:git init

将当前目录所有的内容添加到源里面: git add .

最后输入:git commit -m ‘Initial commit’

接下来会出现一个本地git源所执行的改变列表,如图



打开Xcode,Xcode>Quit Xcode,然后重新启动它,在新添加的git项目中,如果你再次打开Source Control菜单,你会发现所有的选项已经被使能了,就像一开始勾选上创建git源一样。如图:



添加Git中错误以及解决方案

问题:

bogon:getpost mac$ git commit -m 'Initial commit'

*** Please tell me who you are.

Run

git config --global user.email "you@example.com"
git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'mac-fqq@bogon.(none)')
bogon:getpost mac-fqq$ git commit -m 'Initial commit'

*** Please tell me who you are.

Run

git config --global user.email "you@example.com"
git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'mac@bogon.(none)')


解决方案参考:http://blog.csdn.net/baobeijuzi/article/details/44081691

Git的使用

master为项目的源,可以创建其它分支对源项目进行添加功能,最后将分支和主项目进行修改,对于修改后的项目需要更新,详细使用参考

http://www.cocoachina.com/ios/20140524/8536.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: