使用git管理项目

弄了一个SAE云应用跑定时脚本,但是脑抽选了使用git方式管理项目。选完才发现自己完全不会,搞了一下午,才把代码发布上去。
下面几条关键命令,自己mark一下。

(1)创建一个新的Git仓库并且添加一个Git远程仓库sae,地址为:https://git.sinacloud.com/newapp

$ mkdir newapp
$ cd newapp
$ git init
$ git remote add sae https://git.sinacloud.com/newapp

(2)上传代码

$ git add index.php
$ git commit -m"initial commit"
$ git push sae master:1

(3)删除版本1的代码

$ git push sae :1

最后推送代码的时候总是要输入账号密码,神烦,可以用 credential helper 来避免每次提交都要输入密码。

$ git config --global credential.helper cache
# Set git to use the credential memory cache
$ git config --global credential.helper 'cache --timeout=3600'
# Set the cache to timeout after 1 hour (setting is in seconds)

(3)克隆代码

git clone -o sae https://git.sinaapp.com/gitsrc
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值