Skip to content

Instantly share code, notes, and snippets.

@JessCodes
Last active February 6, 2017 20:24
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JessCodes/4c8b02e1efced74aec74261685bf400c to your computer and use it in GitHub Desktop.
Save JessCodes/4c8b02e1efced74aec74261685bf400c to your computer and use it in GitHub Desktop.

Creating a Rails App, Pushing to Github, Deploying to Heroku

Rails & Github:

'rails new <new-app> --database=postgresql’ 
cd <new-app>
git init
git add
git commit -m “Initial commit"

Create a new repo on Github. Choose your .gitgonore, README and licensing for what you prefer. In the command line of the project:

git remote add origin git@github.com:<username>/<new_app>.git

If you initiliazed the new repo on Github with either of the files or licensing, you'll need to:

git pull

and then:

git push origin master

Before you go back to github and do a pull request, you can checkout a new 'development' branch

git co -b development
git push origin development

On Github, go to Settings -> Branches and then change master to development for the default branch

'feature', 'release', and 'hotfix' branches can be made off of the development-branch locally

You can add collaborators if you want and your repo is ready for creating an amazing Rails app!

Heroku:

heroku 
heroku create <app-name> 
heroku run rake db:migrate
git push heroku development:master

Solutions to a couple of common problems:

✧ Make sure gem 'pg' is under production in your Gemfile:

group :production do
  gem 'pg'
end

✧ Seed your db:

heroku run rake db:seed 

✧ Drop and recreate the db:

heroku pg:reset 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment