git《團隊開發(fā)》 使用 2021-04-01

01. 建立代碼倉庫(專門用于團隊開發(fā)的代碼倉庫)

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

切換目錄
$ cd /Users/Desktop/git演練/公司/weibo
建立空白代碼庫(專門用于團隊開發(fā))
$ git init --bare

02. 項目經理準備項目(前奏)

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

切換目錄
$ cd /Users/Desktop/git演練/經理
"克隆"代碼庫到本地
$ git clone /Users/Desktop/git演練/公司/weibo/
個人信息配置(因為要演示一臺機器上的多人協(xié)作,日常開發(fā)可以忽略)
$ 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. 創(chuàng)建項目

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

提交同時"push"到遠程代碼倉庫

04. 新人加入

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

1.上傳代碼
$ git push
2.拉取代碼
$ git pull

05. 分布式的代碼庫 - 僅供參考

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

由于git是分布式的,任何一臺計算機上都保留有完整的代碼庫的內容,因此可以把團隊開發(fā)的代碼庫放在任何位置
最后編輯于
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內容

友情鏈接更多精彩內容