Managing Multiple Environments for an App


Create your servers and fix your remotes

We’ll need to create both remote environments, staging and production.Since we’ll be pushing to two applications we are using the –remote argument to make two sensibly named remotes.

First create staging:
$ heroku create --remote staging

Push code to heroku:
$ git push staging master
Migrate database:
$ heroku run rake db:migrate --remote staging
Get remote inof:
$ heroku ps --remote staging
Then production:
First create production:
$ heroku create --remote production

Push code to heroku:
$ git push production master
Migrate database:
$ heroku run rake db:migrate --remote production
Get remote inof:
$ heroku ps --remote production

Linking local branches to remote apps

This pushes my local topic branch named red-bg into remote branch master on the remote repository named production.

git config remote.[remoteName].push [localBranchName]:[remoteBranchName]

$ git config remote.production.push red-bg:master

$ git push production red-bg:master -f

Also, you can do this directly with git push:

$ git push heroku +HEAD:master
$ git push -f heroku HEAD:master

That’s it 🙂


			

Every thing with git


1. Track status of modified file.

pravinmishra@ubuntu:~/workSpace/every_thing_with_git$ git status -s
M app/assets/stylesheets/scaffolds.css.scss

2.Track difference in file.

pravinmishra@ubuntu:~/workSpace/every_thing_with_git$ git diff
diff –git a/app/views/orders/index.html.erb b/app/views/orders/index.html.erb
index d2c3f03..9b9bd01 100644
— a/app/views/orders/index.html.erb
+++ b/app/views/orders/index.html.erb
@@ -26,4 +26,4 @@

<h2>nothing</h2>

-<h1>nothing</h1>
+<h1>pravinmishra88@gmail.com</h1>

3.Shows abbreviated commits and a nice graph of branches with the messages on a single line.

pravinmishra@ubuntu:~/workSpace/every_thing_with_git$ git config –global alias.lol “log –pretty=oneline –abbrev-commit –graph –decorate”
pravinmishra@ubuntu:~/workSpace/every_thing_with_git$ git lol
*   84cdcd1 (HEAD, master) Merge branch ‘blue’
|\
| * f534661 (blue) yellow
* |   2d06b84 Merge branch ’email’
|\ \
| |/
|/|
| * 520585c (email) change email
* | 85a0703 blue background
|/
* b0f4f06 (rspec-test) few changes
* 1ff053a (origin/master) first commit

4. Stage the changes. In order to begin tracking a new file, you use the command git add.

git add (file)

5. Review your changes. The main tool you use to determine which files are in which state is the git
status command.

git status/diff

6.Stage and commit

git commit -a

7. Get a Reference(The ref in the URL must be formatted as heads/branch, not just branch. )

pravinmishra@ubuntu:~/workSpace/every_thing_with_git$ find .git/refs
.git/refs
.git/refs/tags
.git/refs/heads
.git/refs/heads/email
.git/refs/heads/blue
.git/refs/heads/master
.git/refs/heads/rspec-test
.git/refs/remotes
.git/refs/remotes/origin
.git/refs/remotes/origin/master

8.Ignoring Files

Often, you’ll have a class of files that you don’t want Git to automatically
add or even show you as being untracked. These are generally automatically
generated files such as log files or files produced by your build system. In such
cases, you can create a file listing patterns to match them named .gitignore.

$ cat .gitignore
*.[oa]
*~

9.Remove file
To remove a file from Git, you have to remove it from your tracked files (more
accurately, remove it from your staging area) and then commit. The git rm
command does that and also removes the file from your working directory so
you don’t see it as an untracked file next time around.
$ git rm file_name

10. Moving file

If you want to rename a file in Git, you can run something like
$ git mv file_from file_to

11. Viewing the commit history

-See all commit by date and user

$ git log

-options is -p, which shows the diff introduced in each commit.
$ git log -p -2
Merge: 2d06b84 f534661
Author: Pravin  Mishra <diatm.pravin.it.07.27@gmail.com>
Date:   Thu Sep 6 23:48:41 2012 +0530

Merge branch ‘blue’

commit f5346619e66f9e59ed6141ba46ec7bd899d82de0
Author: Pravin  Mishra <diatm.pravin.it.07.27@gmail.com>
Date:   Thu Sep 6 23:48:05 2012 +0530

yellow

diff –git a/app/assets/stylesheets/scaffolds.css.scss b/app/assets/stylesheets/scaffolds.css.scss
index 99d7183..8a4b162 100644
— a/app/assets/stylesheets/scaffolds.css.scss
+++ b/app/assets/stylesheets/scaffolds.css.scss
@@ -1,5 +1,5 @@
body {
–  background-color: blue;
+  background-color: yellow;
color: #333;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 13px;

-if you want to see some abbreviated stats for each commit, you can use the –stat option:
$ git log –stat
commit 84cdcd11c41c66897ec8327615028742071ae1f8
Merge: 2d06b84 f534661
Author: Pravin  Mishra <diatm.pravin.it.07.27@gmail.com>
Date:   Thu Sep 6 23:48:41 2012 +0530

Merge branch ‘blue’

commit f5346619e66f9e59ed6141ba46ec7bd899d82de0
Author: Pravin  Mishra <diatm.pravin.it.07.27@gmail.com>
Date:   Thu Sep 6 23:48:05 2012 +0530

yellow

app/assets/stylesheets/scaffolds.css.scss |    2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

commit 2d06b8425bcb28592835ce1133f500e243770cb6
Merge: 85a0703 520585c
Author: Pravin  Mishra <diatm.pravin.it.07.27@gmail.com>
Date:   Thu Sep 6 23:43:54 2012 +0530

Merge branch ’email’

-This option changes the log output to formats other than the default.
$ git log –pretty=oneline
84cdcd11c41c66897ec8327615028742071ae1f8 Merge branch ‘blue’
f5346619e66f9e59ed6141ba46ec7bd899d82de0 yellow
2d06b8425bcb28592835ce1133f500e243770cb6 Merge branch ’email’
520585c934bad43db8a390333c103c552a393f9e change email
85a070328bff3bf5835f7b27389899a00b817102 blue background
b0f4f06fae59165f0f797b5e056d259726b3d455 few changes
1ff053a7037e907af4a60cfdd34eca29da75f6f3 first commit

-This option adds a nice little ASCII graph showing your branch and merge history, which we can see our copy of the Grit project repository:
$ git log –pretty=format:”%h %s” –graph
*   84cdcd1 Merge branch ‘blue’
|\
| * f534661 yellow
* |   2d06b84 Merge branch ’email’
|\ \
| |/
|/|
| * 520585c change email
* | 85a0703 blue background
|/
* b0f4f06 few changes
* 1ff053a first commit

12.Limit log output

We can time-limiting options such as –since and –until are very useful.
$ git log –since=2.weeks
commit 84cdcd11c41c66897ec8327615028742071ae1f8
Merge: 2d06b84 f534661
Author: Pravin  Mishra <diatm.pravin.it.07.27@gmail.com>
Date:   Thu Sep 6 23:48:41 2012 +0530

Merge branch ‘blue’

commit f5346619e66f9e59ed6141ba46ec7bd899d82de0
Author: Pravin  Mishra <diatm.pravin.it.07.27@gmail.com>
Date:   Thu Sep 6 23:48:05 2012 +0530

12. Undoing Things

-One of the common undos takes place when you commit too early and possibly forget to add some files, or you mess up your commit message. If you want to try that commit again, you can run commit with the –amend option:

$ git commit –amend

Unstaging a Staged File
$ git status
# On branch master
# Your branch is ahead of ‘origin/master’ by 1 commit.
#
# Changes not staged for commit:
#   (use “git add <file>…” to update what will be committed)
#   (use “git checkout — <file>…” to discard changes in working directory)
#
#    modified:   README.rdoc
#    modified:   Rakefile
#
no changes added to commit (use “git add” and/or “git commit -a”)
pravinmishra@ubuntu:~/workSpace/every_thing_with_git$ git add .
pravinmishra@ubuntu:~/workSpace/every_thing_with_git$ git status
# On branch master
# Your branch is ahead of ‘origin/master’ by 1 commit.
#
# Changes to be committed:
#   (use “git reset HEAD <file>…” to unstage)
#
#    modified:   README.rdoc
#    modified:   Rakefile
#
pravinmishra@ubuntu:~/workSpace/every_thing_with_git$ git reset HEAD Rakefile
Unstaged changes after reset:
M    Rakefile
pravinmishra@ubuntu:~/workSpace/every_thing_with_git$ git status
# On branch master
# Your branch is ahead of ‘origin/master’ by 1 commit.
#
# Changes to be committed:
#   (use “git reset HEAD <file>…” to unstage)
#
#    modified:   README.rdoc
#
# Changes not staged for commit:
#   (use “git add <file>…” to update what will be committed)
#   (use “git checkout — <file>…” to discard changes in working directory)
#
#    modified:   Rakefile

4oo. Tree of git files

pravinmishra@ubuntu:~/workSpace/every_thing_with_git$ tree -a
.
├── app
│   ├── assets
│   │   ├── images
│   │   │   └── rails.png
│   │   ├── javascripts
│   │   │   ├── application.js
│   │   │   └── orders.js.coffee
│   │   └── stylesheets
│   │       ├── application.css
│   │       ├── orders.css.scss
│   │       └── scaffolds.css.scss
│   ├── controllers
│   │   ├── application_controller.rb
│   │   └── orders_controller.rb
│   ├── helpers
│   │   ├── application_helper.rb
│   │   └── orders_helper.rb
│   ├── mailers
│   │   └── .gitkeep
│   ├── models
│   │   ├── .gitkeep
│   │   └── order.rb
│   └── views
│       ├── layouts
│       │   └── application.html.erb
│       └── orders
│           ├── edit.html.erb
│           ├── _form.html.erb
│           ├── index.html.erb
│           ├── new.html.erb
│           └── show.html.erb
├── config
│   ├── application.rb
│   ├── boot.rb
│   ├── database.yml
│   ├── environment.rb
│   ├── environments
│   │   ├── development.rb
│   │   ├── production.rb
│   │   └── test.rb
│   ├── initializers
│   │   ├── backtrace_silencers.rb
│   │   ├── inflections.rb
│   │   ├── mime_types.rb
│   │   ├── secret_token.rb
│   │   ├── session_store.rb
│   │   └── wrap_parameters.rb
│   ├── locales
│   │   └── en.yml
│   └── routes.rb
├── config.ru
├── db
│   ├── migrate
│   │   └── 20120731003213_create_orders.rb
│   ├── schema.rb
│   └── seeds.rb
├── doc
│   └── README_FOR_APP
├── Gemfile
├── Gemfile.lock
├── .git
│   ├── branches
│   ├── COMMIT_EDITMSG
│   ├── COMMIT_EDITMSGtest
│   ├── COMMIT_EDITMSGtestt
│   ├── COMMIT_EDITMSGtesttM-A
│   ├── config
│   ├── description
│   ├── HEAD
│   ├── hooks
│   │   ├── applypatch-msg.sample
│   │   ├── commit-msg.sample
│   │   ├── post-update.sample
│   │   ├── pre-applypatch.sample
│   │   ├── pre-commit.sample
│   │   ├── prepare-commit-msg.sample
│   │   ├── pre-rebase.sample
│   │   └── update.sample
│   ├── index
│   ├── info
│   │   └── exclude
│   ├── logs
│   │   ├── HEAD
│   │   └── refs
│   │       ├── heads
│   │       │   ├── blue
│   │       │   ├── email
│   │       │   ├── master
│   │       │   └── rspec-test
│   │       └── remotes
│   │           └── origin
│   │               └── master
│   ├── objects
│   │   ├── 00
│   │   │   └── 7ce9c43328f559333b67ab5661248fd3555aff
│   │   ├── 01
│   │   │   └── a7a5fc116da111c0bc377b87972824ac5a5d5a
│   │   ├── 02
│   │   │   └── 5d1b1f1862d54aad0677bb80baec240fc27db7
│   │   ├── 05
│   │   │   ├── 188f08ed67cd28c1540da208992d57bc50f5d2
│   │   │   └── f4b2c6730253dd0533e426aad35d9551aa49bf
│   │   ├── 08
│   │   │   └── 5187fa58b1631e955f5d514d895a7721466797
│   │   ├── 0d
│   │   │   └── d897d9f57ced84d38e2776d21bf3fba6cb30d6
│   │   ├── 0f
│   │   │   └── bf4a10a9e4e258a83e6857411bc1a87ab5534e
│   │   ├── 12
│   │   │   └── e53b5cfb7713b7886a2e6de22b37be63cb1828
│   │   ├── 15
│   │   │   ├── 438849134f3078999b496a312773c88cecd84e
│   │   │   ├── 4705c6aa1c8ead8c99c7915373e3c44012057f
│   │   │   ├── 93355496d89e475ab4cd45808a7001dc6bd933
│   │   │   └── b8ed1348be35f46103e9a0cd10fec2b4919930
│   │   ├── 17
│   │   │   └── 9c14ca52c384fc27f42fa76ea982c4674b3c20
│   │   ├── 19
│   │   │   └── cb1c637acfd6f8ab180aaf1b0b45b610cbf006
│   │   ├── 1f
│   │   │   ├── 3bebad2659e088ac0c926c18511666b3c8b4b8
│   │   │   └── f053a7037e907af4a60cfdd34eca29da75f6f3
│   │   ├── 20
│   │   │   └── 4e9b656452b48c9dd9226255fdf17bd84d5ca1
│   │   ├── 21
│   │   │   └── 1748af0c417e6a03c6cb6f76d35e7d46d7d1f4
│   │   ├── 22
│   │   │   └── 68ce8216edd04b11b2e969997d799ed36bf90e
│   │   ├── 24
│   │   │   └── 20abe3038342909597705c910ffb8dfc6bd38b
│   │   ├── 27
│   │   │   └── abbf6392125b7c185f341d05b9369fde8ea5aa
│   │   ├── 28
│   │   │   └── c4a60cb62d6a5ef24ec8da1433d456fc5996e5
│   │   ├── 2b
│   │   │   └── 82d8b75e96d533432d9f11ee85462c1fd42393
│   │   ├── 2c
│   │   │   └── 56fa20dfed26d706d0e42e1fedcd310465f2d6
│   │   ├── 2d
│   │   │   ├── 06b8425bcb28592835ce1133f500e243770cb6
│   │   │   └── efd72e4d0a58b91b25f17f9d09315378b9d11d
│   │   ├── 30
│   │   │   └── 8bd499ed787a5661f7d537430c46884bad2a64
│   │   ├── 31
│   │   │   └── 92ec897bb6021141b0d304b724886d0907c0db
│   │   ├── 32
│   │   │   └── bbc36b8f5793223ef2c67308d344250fbdeb01
│   │   ├── 35
│   │   │   └── 37cfa635ef6d89fd8f5b51423ff364e79321c6
│   │   ├── 3b
│   │   │   └── 0428a94ef40b42809434e8b8fd289cd84b5b56
│   │   ├── 3c
│   │   │   └── 8f3fa4a33a630600099cce22c4bad1f420b89b
│   │   ├── 3f
│   │   │   ├── 5ddd8378f7b1bd43edf3bdbf6d8c923878f85c
│   │   │   ├── 91c121c8803e43a570061c7c43229602937458
│   │   │   └── ea27b91670e04c83a15269790a44b41b7d9ce1
│   │   ├── 42
│   │   │   ├── f6f6014f3d56aa9a43686c5de88c1860f9b715
│   │   │   └── fa3b2ead43317131e51b1e179c0eb58b319f82
│   │   ├── 43
│   │   │   └── d29f4f52246e7203a60c102c390c11ad55f474
│   │   ├── 44
│   │   │   ├── 3227fd481070889635a8205fb8ee06148fa209
│   │   │   ├── 89e58688ca642d8e0e9489f6896f49f9b89da6
│   │   │   └── 9b797391bd561d7aeb4adf870b6bddafe469b2
│   │   ├── 45
│   │   │   └── 774453e52bc437ff39123d471007b860095e86
│   │   ├── 46
│   │   │   └── 8d484a61f2d000ee5951262b9a1d51bf32a102
│   │   ├── 47
│   │   │   ├── c0f123aa7cd47e0f7169585a6d560aefabc65e
│   │   │   └── ddd6d409e52291d937d65a40ab88e7af3053f2
│   │   ├── 48
│   │   │   └── 6da35de91d3892e489f691c37bf25255addca3
│   │   ├── 49
│   │   │   ├── 30a6b713cd0c6f40160a427ef3f7581fcbbd3f
│   │   │   └── d4560b3981a89676c58e26550fded2ad5e9685
│   │   ├── 4a
│   │   │   ├── c1b3d98e3a170c44a846ddaf6d46721586d29c
│   │   │   └── ed04aba9a88a2cce4a3270fed3056e3ede6f43
│   │   ├── 4b
│   │   │   └── 66d04a4f062834cec2c55805291fed724b98f6
│   │   ├── 4e
│   │   │   ├── 10bf15eb422c2f87467cd41bc4875152918845
│   │   │   └── db1e857ee6c203463c7fa0387aae32496ec93d
│   │   ├── 50
│   │   │   └── 9ea6b2a89e29512b4fd0c92c1c4466dc18e8f8
│   │   ├── 52
│   │   │   ├── 0585c934bad43db8a390333c103c552a393f9e
│   │   │   └── dacae1997b7b0b90706a51b91860b114cc1a04
│   │   ├── 53
│   │   │   └── 091f8d943728655c2de5e283c5e2041f35d500
│   │   ├── 59
│   │   │   └── 385cdf379bd06a8d2326dcd4de6d5cd5d3f5b0
│   │   ├── 5a
│   │   │   └── 67a145b11f852d9e45e34afca9c5e5b03c2ea3
│   │   ├── 5b
│   │   │   └── 3cf596fc4c3779536f5b9c29cb49af36938fe5
│   │   ├── 5c
│   │   │   └── 302a4dd4b189d391fe0b0a59faacbc6aa62123
│   │   ├── 5d
│   │   │   └── 8d9be237b28d4ebdad9cec9510764ab88154e6
│   │   ├── 67
│   │   │   └── 0521830734291afbea54a6cad7bc1d5cc62e80
│   │   ├── 72
│   │   │   ├── a250e46f5ec97389f062760951692adb720e49
│   │   │   └── aca7e441e1855f8c7a7ac1f1cbe5d42cd1235b
│   │   ├── 75
│   │   │   └── 3d544d7891331263a1e4ca047cab572b839565
│   │   ├── 76
│   │   │   └── 1567942fc20b22ba68ce6b5f46652cf63c48c0
│   │   ├── 77
│   │   │   └── 3f006428ea5ea0ac1101ab7e1f5914eda247a8
│   │   ├── 7c
│   │   │   └── 36f2356ecd12c70a4bfcde0ff671e560daf460
│   │   ├── 7f
│   │   │   └── be8dcb97d0e801b6ec9fc4278d7c420a797cc5
│   │   ├── 83
│   │   │   ├── 660ab1878ba9adc6477ed910333e32bb6b46ce
│   │   │   └── 813df06fda0023b88014318c01f788ea17406f
│   │   ├── 84
│   │   │   └── cdcd11c41c66897ec8327615028742071ae1f8
│   │   ├── 85
│   │   │   └── a070328bff3bf5835f7b27389899a00b817102
│   │   ├── 88
│   │   │   └── bef2ca81958faed1a6f5d006d14f26a1242ead
│   │   ├── 8a
│   │   │   └── 4b162bdb9f2d82d0dc38316444af0cefa5164e
│   │   ├── 8b
│   │   │   └── f1192ffec252a4562218bdf299891a319b9cb9
│   │   ├── 90
│   │   │   └── 97d830e2c27e4b1dd291b1e3ee72149251cca1
│   │   ├── 93
│   │   │   └── 30726268264424cda78f32f874bae8f61c24f8
│   │   ├── 97
│   │   │   └── 939a10a5523838c7f3ca1a3dd6bfb5b3406328
│   │   ├── 99
│   │   │   ├── 9df20181e5571fb6a74259eead0899b7ad18a1
│   │   │   └── d71831621c0f06529c39b21105a8402080310b
│   │   ├── 9a
│   │   │   ├── 48320a5f1c025b6cc9819ab539a6d17fcbaf81
│   │   │   └── 6d84a35b2adc97e67f9bdcc8eb7f17f49b48d9
│   │   ├── 9b
│   │   │   └── 9bd01b00b30ab6ee52b3e86a16ce1cf844808d
│   │   ├── 9e
│   │   │   └── 2aeb8f9431726fb731bca2159a644e30e811fb
│   │   ├── 9f
│   │   │   └── 1580f4e69b030b59fceed046480856dd209df1
│   │   ├── ac
│   │   │   └── 2e8ba6a1b189557429b5ae2f59731e101728fb
│   │   ├── b0
│   │   │   ├── 7ade6c63bc0f43b5f33acda4822a4ff37361ea
│   │   │   └── f4f06fae59165f0f797b5e056d259726b3d455
│   │   ├── b4
│   │   │   └── 0d2b59d1e32e5056ba427b9b3fd0644630f683
│   │   ├── b5
│   │   │   └── 91a352dc8adfcbc781dfbcaed4d5489b3d0175
│   │   ├── bd
│   │   │   └── 5ae3fecb4feaf0f865888edc9759d5c3d36232
│   │   ├── c2
│   │   │   └── e811817ee56b7c4f80a98a0e29215af57c2a3a
│   │   ├── c4
│   │   │   └── f14ff630a65048705dd1848a773aec6e98e321
│   │   ├── cb
│   │   │   └── deac2798cb5fde79016e7ee7961331aa4f7c7b
│   │   ├── ce
│   │   │   └── 506525fe3467ef70cf1485a2793300622534d6
│   │   ├── d2
│   │   │   └── c3f035da1c14b4efead05e6f9db416a290fde2
│   │   ├── d5
│   │   │   ├── 64d0bc3dd917926892c55e3706cc116d5b165e
│   │   │   └── edc04e65f555e3ba4dcdaad39dc352e75b575e
│   │   ├── d9
│   │   │   └── 2e427847e01b1a6f07b19e25e7b0668efaec69
│   │   ├── dd
│   │   │   ├── 05fa5b40902c631ed1a82d379e7054f88e59ad
│   │   │   └── fbd7c203be41f36d2ac1404857500f1f865b2e
│   │   ├── de
│   │   │   └── 6be7945c6a59798eb0ace177df38b05e98c2f0
│   │   ├── e1
│   │   │   └── 06f5eb4da1651e7a2e3d01d65eab298f9b38e4
│   │   ├── e3
│   │   │   └── ed01cb6b9dc73ab83658f50f17770af0b6db2a
│   │   ├── e6
│   │   │   └── 9de29bb2d1d6434b8b29ae775ad8c2e48c5391
│   │   ├── e8
│   │   │   └── 065d9505d7ec6f727021c827de18a0a95737de
│   │   ├── ea
│   │   │   └── 3ba0e03a6b78f2a812f1dccbf99ea2a1ddabbc
│   │   ├── eb
│   │   │   └── 3489a986bd8af22f03119e8989e9d10a4999d4
│   │   ├── ed
│   │   │   ├── 7931e3f168c9831579326b56de3f3c68f3b5da
│   │   │   └── ae7ef0915f4b60dd173a268a92ce766009152c
│   │   ├── f3
│   │   │   └── 648a0dbc9f021131677c88383f1cc9b15ea22e
│   │   ├── f5
│   │   │   ├── 346619e66f9e59ed6141ba46ec7bd899d82de0
│   │   │   └── 491c2323e75b9df95eb3c8f5a1cd064bc35a8b
│   │   ├── f7
│   │   │   ├── 6cb1d43f2a6ea96e48e95cf70d3a8704dd5072
│   │   │   └── bd8f6a14841f95d2840ab870dddb1132c730b2
│   │   ├── f8
│   │   │   └── da2cffd4de029d658fe2f7b9ec88f28dc34a9a
│   │   ├── fc
│   │   │   └── 6ef9282895a78dafdb3ebe9a982db6a9f1e0a0
│   │   ├── fd
│   │   │   └── e0ce2e205f9f0f055727dc7b6c5df08e362b6a
│   │   ├── fe
│   │   │   └── 41f5cc24d667635c46a533fd09bf7bb514e032
│   │   ├── info
│   │   └── pack
│   ├── ORIG_HEAD
│   └── refs
│       ├── heads
│       │   ├── blue
│       │   ├── email
│       │   ├── master
│       │   └── rspec-test
│       ├── remotes
│       │   └── origin
│       │       └── master
│       └── tags
├── .gitignore
├── lib
│   ├── assets
│   │   └── .gitkeep
│   └── tasks
│       └── .gitkeep
├── log
│   ├── development.log
│   └── .gitkeep
├── public
│   ├── 404.html
│   ├── 422.html
│   ├── 500.html
│   ├── favicon.ico
│   └── robots.txt
├── Rakefile
├── README.rdoc
├── script
│   └── rails
├── test
│   ├── fixtures
│   │   ├── .gitkeep
│   │   └── orders.yml
│   ├── functional
│   │   ├── .gitkeep
│   │   └── orders_controller_test.rb
│   ├── integration
│   │   └── .gitkeep
│   ├── performance
│   │   └── browsing_test.rb
│   ├── test_helper.rb
│   └── unit
│       ├── .gitkeep
│       ├── helpers
│       │   └── orders_helper_test.rb
│       └── order_test.rb
├── tmp
│   ├── cache
│   │   ├── assets
│   │   │   ├── C58
│   │   │   │   └── E30
│   │   │   │       └── sprockets%2F4e829185f1504944b41c494529b66bb4
│   │   │   ├── CB5
│   │   │   │   └── 9E0
│   │   │   │       └── sprockets%2Fe459168835a5f27b832ace20874f7c10
│   │   │   ├── CC2
│   │   │   │   └── 5A0
│   │   │   │       └── sprockets%2F2630585056a1db4f59b004c2aa5122cd
│   │   │   ├── CD7
│   │   │   │   └── 6F0
│   │   │   │       └── sprockets%2Fbd3936370d0f952ada5774e2230046ed
│   │   │   ├── CD8
│   │   │   │   └── 370
│   │   │   │       └── sprockets%2F357970feca3ac29060c1e3861e2c0953
│   │   │   ├── CF0
│   │   │   │   └── DA0
│   │   │   │       └── sprockets%2Fd7d5b37686831d37c4dd75e645f5e016
│   │   │   ├── CF4
│   │   │   │   └── CE0
│   │   │   │       └── sprockets%2Fda5971a6f6cc7e9923f28850c46625b8
│   │   │   ├── D1F
│   │   │   │   └── D30
│   │   │   │       └── sprockets%2F6c9f4608bd916f573fafb413927d4d09
│   │   │   ├── D20
│   │   │   │   └── BA0
│   │   │   │       └── sprockets%2Fe8d306af79db99713a3334ea95957d2c
│   │   │   ├── D32
│   │   │   │   └── A10
│   │   │   │       └── sprockets%2F13fe41fee1fe35b49d145bcc06610705
│   │   │   ├── D33
│   │   │   │   └── E20
│   │   │   │       └── sprockets%2F25e6a0c3cf070477edaae503564f426c
│   │   │   ├── D4E
│   │   │   │   └── 1B0
│   │   │   │       └── sprockets%2Ff7cbd26ba1d28d48de824f0e94586655
│   │   │   ├── D5A
│   │   │   │   └── EA0
│   │   │   │       └── sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6
│   │   │   ├── D7E
│   │   │   │   └── 510
│   │   │   │       └── sprockets%2Fe5289c1e989b8dd6656cd939e0ac0ac0
│   │   │   ├── D82
│   │   │   │   └── 350
│   │   │   │       └── sprockets%2F4cfa19f9bca26dc87fd9550127f4759e
│   │   │   ├── DDC
│   │   │   │   └── 400
│   │   │   │       └── sprockets%2Fcffd775d018f68ce5dba1ee0d951a994
│   │   │   ├── DED
│   │   │   │   └── F70
│   │   │   │       └── sprockets%2F7ed83d0c16cbc2b202b4c65baeec647c
│   │   │   ├── E04
│   │   │   │   └── 890
│   │   │   │       └── sprockets%2F2f5173deea6c795b8fdde723bb4b63af
│   │   │   ├── E0F
│   │   │   │   └── F70
│   │   │   │       └── sprockets%2F96eea36d34f8fef13ff7a1d0576d8eae
│   │   │   ├── E19
│   │   │   │   └── 2A0
│   │   │   │       └── sprockets%2F10fcfbe6ebae11a40c8eac41939a1b9a
│   │   │   └── E25
│   │   │       └── 4C0
│   │   │           └── sprockets%2Fde2fd9fd11c04a582cdbbe3d84a35ae6
│   │   └── sass
│   │       └── 7d2ae8fecd82f6692540c213575bf838322da99d
│   │           ├── orders.css.scssc
│   │           └── scaffolds.css.scssc
│   ├── pids
│   │   └── server.pid
│   ├── sessions
│   └── sockets
└── vendor
├── assets
│   ├── javascripts
│   │   └── .gitkeep
│   └── stylesheets
│       └── .gitkeep
└── plugins
└── .gitkeep

200 directories, 242 files

Create a branch in github


We always used to create a branch on local system and after verify and ok with code, we merged to master branch. Today i was facing situation, i need to create a branch on remote git repository. Actually my manager wanted to take look to my code before merge to master branch(As he is residing out of country).

1.First create the branch locally:

git branch rspec-test-import

2.List all local branch.

git branch
*master
rspec-test-import

3.Checkout to local branch.
git checkout rspec-test-import

4.Again list branch and see where we are?
git branch
master
*rspec-test-import

5.Now create the remote branch and push your code.
git push --all
OR
git push origin rspec-test-import

That's it. Now you able to pull and push your changes to branch repository too. 
Cheers..!!!!!

Git: git Add, git Commit, git Push, git Status,git Pull,git Merge


Why Git?
->Git is version-??control software.We can also say GIT is a tool to manage software development process.
 It keeps track of all the changes to your files in a project repository .
Its powerful tools let you view your changes, helping you fix your code so that it’s free of a certain bug.
Git really changed the way developers think of merging and branching. Merging/branching has always been
considered a bit scary.But with Git, these actions are extremely cheap and simple, and they are considered
 one of the core parts of your daily workflow.

What is repository?
->A repository is a collection of files and directories (your project), as well as a list of changes
to those files over the life of the repository.

What is Origin?
->origin is the default name of the remote git repository.The central repository holds two main
 branches with an infinite lifetime:
(a)origin=Origin is the main branch of repository where last commit held. This origin/master always
 modify at last commit and ready for production state.
(b)develop=Parallel to the master branch, another branch exists called develop.We consider
 origin/develop to be the main branch where the source code of HEAD always reflects a state
with the latest delivered development changes for the next release(commit, then update origin/master).

Basic Terms in Git.
Branching->Branching is a process of making new copy of origin repository(basically master branch) for
 further modification which independent from from origin branch and ultimately we can merge when happy with our new creation. So ultimate Git will allow you to have
 multiple local branches that can be entirely independent of each other and the creation, merging
 and deletion of those lines of development.Git makes this process incredibly easy and it changes
 the way most developers work when they learn it.
Merging->Merging is just opposite of branching. In case of branching we had created a new branch from origin/master but In case of merging we
merge the new created branch from origin/master. It seems too easy as like branching, it's really easy up to single developer OR no changes in local
 branch. The pull command in fact fetches commits and then merges them into your current branch. If you have no local changes, then the merge is a fast
 forward. But if you do have local changes, Git will automatically merge, and report any conflicts.
Now we have basic understanding of GIT and it's related terms. So let's go ahead!!!!!!!!
 
1. init
Init is first command in git. which we has use to Create an empty git repository or reinitialize an existing repository if already created.
if we type git init command on Git Bash it will reply

if you look in command prompt before $git init, git_example repository was not a master. After git init it will reply message
$ git init
Initialized empty Git repository in c:/Sites/git_example/.git/
2.Status
Displays paths that have differences between the previous commit and the current HEAD commit. It shows current branch you working on, The files you modify
since they were last committed, and which files Git knows nothing about. It will indicate if files have been moved or deleted, or if there are merges
that need to be made manually.
$git stauts


 Basically it keep track of three type's of file.
a)File we had committed earlier.
b) Untrack file which still to added to repository.
c)One's more untrack file about which git does not know any thing.
Some more option with $git status for more info.
$git status --short/-s
Give the output in the short-format.
$git status --branch/ -b 
Show the branch and tracking info even in short-format.
$git status --ignored
Show ignored files as well.

3.Add
This command adds the current content of new or modified files to the .git repository, thus staging that content for inclusion in the next commit.