| Task | Command |
|---|---|
| Start server | rails s |
| Start console | rails c |
| Generate a db migration to add columns |
rails generate migration add_column_to_some_table column_name:string...
|
| Generate a db migration to add index |
rails generate migration add_index_to_some_table
|
| Generate new model |
rails generate model loan_charge product:references listener_reference:string
fixed_charge:integer min_charge:integer max_charge:integercharge_percentage:float
|
Showing posts with label Cheatsheet. Show all posts
Showing posts with label Cheatsheet. Show all posts
Tuesday, August 21, 2012
Rails daily usage cheat sheet
Monday, July 9, 2012
Git daily usage cheat sheet
| Task | Command |
|---|---|
| Initialize a new git repository |
git init
|
| View local branches | git branch |
| Create new local branch | git branch [new_branch_name] |
| Delete local branch | git branch -d [branch_name] |
| Switch to a branch | git checkout [branch_name] |
| Add files to git | git add . |
| Undo all current changes. | git checkout . |
| Commit changes | git commit -a -m "Log message" |
| Show git logs | git log |
| Push local to remote | git push origin [branch_name] |
| Pull from remote | git pull origin [branch_name] |
| Merge branch | git merge [from_branch] |
| Show diff | git diff |
| Show all branches | git branch -a |
| Fix a tagged release |
git checkout -b [tag_name]_fixes [tag_name]
OR (for getting a remote branch)
git checkout -b [new_local_branch] origin/[remote_branch]
e.g. git checkout -b myfeature origin/myfeature
|
| Create a new tag | git tag [tag_name] |
| Push tags to remote | git push --tags |
| Overwrite existing tag | git tag -f [tag_name] |
| Delete tag |
git tag -d 12345
git push origin :refs/tags/12345
|
| Merge individual commits | git cherry-pick [commit_hash] |
| Stashing |
git stash
git stash apply
git stash list
|
| Create an empty repository | git --bare init |
| Adding a remote repository |
git remote add origin [server_name]:[directory_name]
|
Checkout a single file on another branch:
$ git checkout branch_name file_full_path
More on: http://gitref.org/index.html
$ git checkout branch_name file_full_path
More on: http://gitref.org/index.html
Labels:
Cheatsheet,
Favourite,
Git
Capistrano cheat sheet
| Description | Command |
|---|---|
| List cap details | cap -T |
| backup database | cap bullitt db:backup:adhoc |
| Deployment without migration | cap bullitt deploy |
| Deployment with migrations | cap bullitt deploy:migrations |
Labels:
Cheatsheet,
Favourite,
Rails
Subscribe to:
Posts (Atom)