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

创建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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值