Other Pages

Add The Project To A Git Repo

Goals

  • Add all our files to the git repository

  • In order to publish our application, we need to add our application and any changes we make over time to a "revision control system". Rails already set up git for us.

Steps

Step 1

Type this in the shell:
git status

git status tells you everything git sees as modified, new, or missing.

Right now there is a long list of folders and files shown in red. We need to add them to the git repository

Step 2

Type this in the shell:
git add -A

git add -A will prepare all the files in the current folder for the next step.

Step 3

Type this in the shell:
git commit -m 'new rails project'

git commit will take a snapshot of the current files and add them to the repository. It will include a message.

Step 4

Type this in the shell:
git log

git log shows you everything that happend until now.

You will see one entry in the log, the initial commit.

git log showing inital commit

Step 5

Type this in the shell:
git status

Now you should see something like nothing to commit, working directory clean which means you've committed all of your changes.

Explanation

By checking your application into git now, you're creating a record of your starting point.

Whenever you make a change to this project, you will add it to git before moving on.

This way, if anything ever breaks, or you make a change you don't like, you can use git as an all-powerful "undo" technique. But that only works when you remember to commit early and often!

Next Step: