码迷,mamicode.com
首页 > 其他好文 > 详细

xcode6 cocos2dx玩转git和github之学习记录

时间:2014-11-04 00:12:49      阅读:206      评论:0      收藏:0      [点我收藏+]

标签:git   xcode   

1. git

Xcode4开始,就已经将Git作为内置的源代码控制(Source Control)工具了,所以为新建的项目使用git来管理是很方便的。在新建项目向导中,可以直接选择Git作为源代码控制工具,完成项目新建向导后,就在本地项目目下新建了一个仓库。

bubuko.com,布布扣

2. 如何为已存在的项目增加git

(1)通过控制台进入项目所在目录,输入如下命令

<span style="font-size:18px;">git init
</span>
(2)如果你的项目存在不想提交的内容如何处理呢?在项目目录下,新建.gitignore文件,在该文件中添加如下排除规则:

*.[oa]
*.lib
*.sdf
*.opensdf
cocos2d/
.git*
proj.win32/Debug.win32/
proj.android/
proj.ios_mac/
proj.linux/
proj.wp8-xaml/
添加了如下规则,git就可以不提交这些代码。

注:

如何新建.gitignore文件? 由于我本机安装了sublime text,所以就先建立文件另存为到响应目录。

新建的.gitignore文件看不见?由于.gitignore文件是隐藏文件,所以终端输入以下命令:

defaults write com.apple.finder AppleShowAllFiles -bool YES 


如果恢复隐藏不可见,在终端中输入以下代码并回车 

defaults write com.apple.finder AppleShowAllFiles -bool NO 
(3)向git仓库添加源文件 

git add .
git commit -m "first commit"

3. 如何将xcode本地git与github仓库集成

(1)首先注册github,网址https://github.com ,登录之后,新建 new repository,填写相应信息,就可以了。

bubuko.com,布布扣bubuko.com,布布扣

(2)本机添加账号信息

打开xcode,选择Preferences,选择“Accounts”,点击添加按钮,输入Repository地址,我的地址就是“https://github.com/用户名/test.git”

User name输入时注意不是邮箱,而是用户名。

bubuko.com,布布扣


(3)通过“终端”进入git所在目录,输入命令

git remote add origin https://github.com/用户名/test.git
git push -u origin master
就可以将本地git仓库提交到github仓库中。


祝君成功~

本文只是我的一些肤浅的认识,大家轻喷~


xcode6 cocos2dx玩转git和github之学习记录

标签:git   xcode   

原文地址:http://blog.csdn.net/lengxue789/article/details/40752297

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!