一、下载代码
- 克隆 codegit 应用代码
# 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
- 查看当前所有版本号
# cd codegit # git branch -a 3 * 5 remotes/origin/3 remotes/origin/5 remotes/origin/HEAD -> origin/5
可以看到,两个版本号,3 和 5。 当前 在版本号 5 下面
- 切换版本号
# git checkout 3 Switched to branch '3' # git branch -a * 3 5 remotes/origin/3 remotes/origin/5 remotes/origin/HEAD -> origin/5
切换到 版本号 3 下面
一、上传代码
创建新版本号 8
# git branch -a * 3 5 remotes/origin/3 remotes/origin/5 remotes/origin/HEAD -> origin/5 # git checkout -b 8 # 创建版本号 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
测试访问
# curl 8.codegit.applinzi.com code 8