一、下載代碼
- 克隆 codegit 應(yīng)用代碼
# git clone https://git.sinacloud.com/codegit Cloning into 'codegit'... Username for 'https://git.sinacloud.com': 輸入您的安全郵箱 Password for 'https://git@sinacloud.com@git.sinacloud.com': 輸入您的安全密碼 remote: Counting objects: 6, done. remote: Compressing objects: 100% (2/2), done. remote: Total 6 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (6/6), done. Checking connectivity... done
- 查看當(dāng)前所有版本號(hào)
# cd codegit # git branch -a 3 * 5 remotes/origin/3 remotes/origin/5 remotes/origin/HEAD -> origin/5
可以看到,兩個(gè)版本號(hào),3 和 5。 當(dāng)前 在版本號(hào) 5 下面
- 切換版本號(hào)
# git checkout 3 Switched to branch '3' # git branch -a * 3 5 remotes/origin/3 remotes/origin/5 remotes/origin/HEAD -> origin/5
切換到 版本號(hào) 3 下面
一、上傳代碼
創(chuàng)建新版本號(hào) 8
# git branch -a * 3 5 remotes/origin/3 remotes/origin/5 remotes/origin/HEAD -> origin/5 # git checkout -b 8 # 創(chuàng)建版本號(hào) 8 Switched to a new branch '8'
修改代碼
# echo "code 8" > index.php # git add index.php # git commit -m "code 8" [8 2d3718a] code 8 1 file changed, 1 insertion(+), 4 deletions(-)
提交代碼
# git push origin 8 Username for 'https://git.sinacloud.com': # 輸入您的 安全郵箱 Password for 'https://git@sinacloud.com@git.sinacloud.com': # 輸入您的安全密碼 Counting objects: 5, done. Writing objects: 100% (3/3), 239 bytes | 0 bytes/s, done. Total 3 (delta 0), reused 0 (delta 0) To https://git.sinacloud.com/codegit * [new branch] 8 -> 8
測(cè)試訪問
# curl 8.codegit.applinzi.com code 8