Some Commonly Used Ror Commands:

1. For skiping bunlde and using mysql

  rails new [project name] --database=mysql --skip-bundle

2. Listing Gemset:

  rvm gemset list

3. Create a Gemset:

  rvm gemset create xyz

4. For Using GemSet:

goto project directory using ”cd” command

  rvm --rvmrc  --create 1.9.3@xyz
  cd ..
  cd [project]
  press y when terminal say that Do you wish to trust this .rvmrc file?
  rvm gemset list (it will show the current gemset)

Now you can do bundle install

5. Prevents the local installation of any production gems

  bundle install --without production

6. Undo Code Generation:

these two commands cancel each other out:

  rails generate controller FooBars baz quux
  rails destroy controller FooBars baz quux

Similarly, we generate a model as follows:

   rails generate model Foo bar:string baz:integer

This can be undone using

   rails destroy model Foo

We can undo a single migration step using

rake db:rollback

Undo and reapply the last migration

rake db:migrate:redo

To go all the way back to the beginning, we can use

rake db:migrate VERSION=0

7. Run Console in sandbox environment:
In this case all the changes will roll back on exit.

  Rails console --sandbox

or

  Rails c --sandbox

Some Common Git commands:

Change username and email

  git config --global user.name "<username>"
  git config --global user.email "<email address>"

For undo the changes of Git

But chages are not commited yet :

  git checkout -f

For creating and moving to new branch:

  git checkout -b <branch name>

For deleting branch:

git branch -d <branch name>

and for deleting without merging the branch

git branch -D <branch name>

For commiting all modified files without use of git add command as a short cut:

git commit -a -m "<message of commit>"

For merging

git merge <branch name>

For reverting to any no of previous commits:

  git reset --soft HEAD~<no of commits to revert>
  git push origin master --force

Check Git Settings

 git config --list 

Remove Git Remote

 git remote rm destination 

Discard conflicts of git pull request

 git reset --merge