Git Heroku 基本命令总结

来源:互联网 发布:电脑数据恢复软件 知乎 编辑:程序博客网 时间:2024/05/25 13:33

1, Git

详细参考 http://help.github.com/linux-set-up-git/ 完成:

(1)Git 安装(一般安装了RoR,这Git早就安装好了);

(2)生成SSH;


Quick Guide 1:Creating and Commiting

$ cd (project-directory)$ git init$ (add some files)$ git add .$ git commit -m 'Initial commit'






Git 与 Heroku 结合: http://devcenter.heroku.com/articles/git

别人的总结参考:

http://guibin.iteye.com/blog/1014369

http://suiaing.wordpress.com/2010/07/11/git%E5%9F%BA%E6%9C%AC%E6%B5%81%E7%A8%8B/

Quick Guide 2:Cloning and Creating a Patch

$ git clone git://github.com/git/hello-world.git$ cd hello-world$ (edit files)$ git add (files)$ git commit -m 'Explain what I changed'$ git format-patch origin/master









2. Heroku

安装heroku gem : $gem install heroku

详细参考: http://devcenter.heroku.com/articles/quickstart

(1) Track your application with Git

$cd PATH/TO/MY_APP$git initInitialized empty Git repository in .git/$git add .$git commit -m "commit new app"Created initial commit 5df2d09: new app44 files changed, 8393 insertions(+), 0 deletions(-)(2) Set up your SSH keys, 参考1中的http://help.github.com/linux-set-up-git/创建完SSH keys后,将其添加到heroku:heroku keys:add (3) Create your Heroku application
$heroku createEnter your Heroku credentials.Email: joe@example.comPassword: Uploading ssh public key /Users/joe/.ssh/id_rsa.pubCreated http://high-sunrise-58.heroku.com/ | git@heroku.com:high-sunrise-58.gitGit remote heroku added可以重命名 application, 进入RoR, application的目录, 运行: heroku rename new_name。 当然最简单的还是创建时命名:heroku create app_name; (4) Push your application to Heroku
$git push heroku master(5) Bootstrap your database
$heroku rake db:migrateNext StepsNow that your application is running, it’s easy to push updates:   1. Develop and test changes locally.   2. Commit code to git :$ git commit -a ("-a" represents committing all changed files).    3. Push your changes to Heroku with :$git push heroku   4. Don't forget to migrate database when db change.
原创粉丝点击