Version Control with Git
Created by Myriam Leggieri, @iammyr for Rails Girls Galway The basic guides that have been merged and adapted are the Ruby on Rails Tutorial, the basic RailsGirls app and the tutorials for creating thumbnails, authenticating users, adding design, deploying to OpenShift and adding comments.
Navigate to the root directory of the first app and initialize a new repository:
Before adding the project to the repository, let’s tell Git which files to ignore - because too frequently subject to changes - by listing them in the .gitignore file. The “rails new” command already create a .gitignore file but let’s extend it with the following.
Add the changes (recursively adding every sub-directory, too).
The “git add” command adds the project files to a staging area, which contains pending changes to your projectbu; you can see which files are in the staging area using the status command:
Now commit the changes while justifying them with a message:
Now we want our changes to be pushed from our local machine to a remote repository. Create a repository called “railsgirls-galway-2014” and fill in the information. Do not to initialize the repository with a README file since “rails new” already created that automatically. Push up your local changes to the remote repository as follows: