git《团队开发》 使用 2021-04-01

01. 建立代码仓库(专门用于团队开发的代码仓库)

=======================================================

切换目录
$ cd /Users/Desktop/git演练/公司/weibo
建立空白代码库(专门用于团队开发)
$ git init --bare

02. 项目经理准备项目(前奏)

=======================================================

切换目录
$ cd /Users/Desktop/git演练/经理
"克隆"代码库到本地
$ git clone /Users/Desktop/git演练/公司/weibo/
个人信息配置(因为要演示一台机器上的多人协作,日常开发可以忽略)
$ git config user.name manager
$ git config user.email manager@163.com
$ touch .gitignore

.gitignore可以指定哪些文件不纳入版本库的管理

参考网址:https://github.com/github/gitignore

命令行中进入与.git同级的目录
$ cd /Users/Desktop/git演练/经理/weibo
将以下命令一次性粘贴到命令行中

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

## User settings
xcuserdata/

## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
*.xcscmblueprint
*.xccheckout

## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
build/
DerivedData/
*.moved-aside
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3

## Obj-C/Swift specific
*.hmap

## App packaging
*.ipa
*.dSYM.zip
*.dSYM

# 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/
#
# Add this line if you want to avoid checking in source code from the Xcode workspace
# *.xcworkspace

# 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://docs.fastlane.tools/best-practices/source-control/#source-control

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

# Code Injection
#
# After new code Injection tools there's a generated folder /iOSInjectionProject
# https://github.com/johnno1962/injectionforxcode

iOSInjectionProject/

将.gitignore添加到代码库
$ git add .gitignore

03. 创建项目

=======================================================

提交同时"push"到远程代码仓库

04. 新人加入

=======================================================

1.上传代码
$ git push
2.拉取代码
$ git pull

05. 分布式的代码库 - 仅供参考

=======================================================

由于git是分布式的,任何一台计算机上都保留有完整的代码库的内容,因此可以把团队开发的代码库放在任何位置
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容