使用Git管理代码

码云:https://git.oschina.net

创建自己的帐号,使用地址:

https://git.oschina.net/flashloft/WeiboDemo.git

打开终端(以下命令都在终端执行)

找个要存放项目的文件夹,执行下面命令

git clone https://git.oschina.net/flashloft/WeiboDemo.git

创建一个.gitignore

touch .gitignore

然后

git add .

在来到在Git上创建项目相同名称的文件夹下,比如:

cd /Users/zhangfan/Library/Mobile\ Documents/com\~apple\~CloudDocs/swiftPractices/WeiboDemo

提交创建的.gitignore,添加一个备注

git commit -m "添加忽略文件"

然后执行Push

git push

swift的gitignore

# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## Build generated
build/
DerivedData/

## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/

## Other
*.moved-aside
*.xcuserstate

## Obj-C/Swift specific
*.hmap
*.ipa
*.dSYM.zip
*.dSYM

## Playgrounds
timeline.xctimeline
playground.xcworkspace

# Swift Package Manager
#
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
.build/

# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# Pods/

# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts

Carthage/Build

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md

fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output

在这个文件夹下创建Xcode工程,就可以通过Source Control管理代码了

Xcode中配置好码云的帐号

通过代码控制工具即可进行代码管理

Commit:写了新的代码通过这个提交,提交的时候一定要写备注,比如这次提交更新了哪些内容

Push:推送到码云

Check Out:检出一个分支

results matching ""

    No results matching ""