Git & Heroku


Premium Content - Free Preview

Git

Although our app is still simple, we'll push it to a live website. To do so, you'll need to learn about git.

Git is version control software, which is what programmers use to track of changes in their code and collaborate with other developers. While git has many powerful features for collaborating on code, we're just going to cover a couple of git commands here.

Setting Git Up

The first time you use git, you should set up your name and email. By default, Cloud9 will set it to the name and email you provided when you signed up. If you want to change it, enter the following in the terminal:

git config --global user.name "Jim Jones"  
git config --global user.email [email protected]

Replace "Jim Jones" with your name, and [email protected] with your email.

To initialize git in a folder for the first time, you would usually enter git init. However, since you cloned this project, git has already been initialized.

To track (almost) everything with git, enter the following command:

git add .

Using git

We'll just cover 2 commands so you can use git to keep track of your changes. Whenever you complete coding a feature, enter these 2 commands:

  1. git add . - This will add all your changes to git.
  2. git commit -m "message about feature" - This will commit your changes to git, along with a message that describes the feature. By committing to git, you're creating a permanent record of the code at this point, which you can later go back to.

We're assuming you're using a cloud IDE and not collaborating with anyone on this project, so right now you can just use git to track changes in your project. Later, you can learn about hosting your code on Github or Bitbucket and practice collaborating with other developers.

Heroku Setup

Heroku is web hosting service that is very easy to use with Rails applications. Follow these simple steps to get set up:


End of Free Content Preview. Please Sign in or Sign up to buy premium content.

Contact Us
Sign in or email us at [email protected]