Let’s play with git practice step by step, shall we?
Here we go:
change into self_practice directory for class T1-2015
cd ~/workspace/davinci_coders_t1_2015/self_practice
make a new directory call practice
mkdir practice
get into the practice directory
cd practice/
In the practice directory, make a git_warmup directory
mkdir git_warmup
get into the git_warmup directory
cd git_warmup/
In the git_warmup directory:
Setup RVM
echo ‘2.1.5’ > .ruby-version
echo ‘git_warmup’ > .ruby-gemset
Get RVM to reload these setting:
cd .
rvm current
Setup Robocop
mine .
When RubyMine is open,
we use shortcut command + N to create a new file.
Type in <Gemfile> and click [OK] button. 
In Gemfile, we type in source ‘http://rubygems.org’ in line 1, and gem ‘guard-rubocop’ in line 3.
Now we bundle the gems into our RubyMine files. 
Time to initialize guard with guard init, ![]()
and you should see in your RubyMine have a Guardfile jump up in there. 
Now when your fire up guard, you will see that there are already 2 offenses for guard file alone. 
To fix this, we highlight the git_warmup directory, and going to create a new file command + N with a name <.rubocop.yml> in RubyMine. 
And put into these code into <.rubocop.yml> to exclude guardfile in rubocop:
AllCops:
Exclude:
- 'Guardfile'
then the rubocop will tell you
.
Setup Git
Command + T in iTerm to open a new tape, git init to create an empty repo locally, adding initial files, check status, commit initial setup files.
If you hit (enter) after git commit, you are now into vim, just hit i turn into Insert mode and type in your commit message ‘Added initial setup files‘, hit [esc] button, type :wq to save the change and quit vim
use git log -p to show any commit in this repo. 
| #!/usr/bin/env ruby | |
| print 'What is your name?' | |
| name = gets.chomp.capitalize | |
| puts "Nice to meet you, #{name}." |
Now I want to check my git status. 
I’m feeling a little lazy today, let’s use gitx [enter]. Now we have a gitx box jump up, and I am using shortcut command + A to selected all files from the left box that I need to commit and draft them to the right box.

put into commit message into the middle and click [commit] button, than close it on the left top [x] red button. 
When we type in git log, and we now have 2 commit repository.
Now, let’s push a new repo on github.
and we put into the Repository name as git_self_practice_for_fun_1, type in Description as just practice git101 for fun, then click [Create repository] button.
Make sure the [ssh] button is check on this new page, since we already have existing repository, we click the clipboard button on the …or push an existing repository from the command line, then go paste it onto iTerm using shortcut command + V [enter]. 
I’m not so sure if I get this down yet, how do I get more practice?
Let’s start the next one in the same directory practice
| Graces-MacBook-Pro:git_warmup2 RiverGracefish$ cd .. | |
| Graces-MacBook-Pro:practice RiverGracefish$ pwd | |
| /Users/RiverGracefish/workspace/davinci_coders_t1_2015/self_practice/practice | |
| Graces-MacBook-Pro:practice RiverGracefish$ ls | |
| git git_warmup | |
| Graces-MacBook-Pro:practice RiverGracefish$ mkdir git_warmup2 | |
| Graces-MacBook-Pro:practice RiverGracefish$ cd git_warmup2 | |
| Graces-MacBook-Pro:git_warmup2 RiverGracefish$ echo '2.1.2' > .ruby-version | |
| Graces-MacBook-Pro:git_warmup2 RiverGracefish$ echo 'git_warmup' > .ruby-gemset | |
| Graces-MacBook-Pro:git_warmup2 RiverGracefish$ cd . | |
| ruby-2.1.2 - #gemset created /Users/RiverGracefish/.rvm/gems/ruby-2.1.2@git_warmup | |
| ruby-2.1.2 - #generating git_warmup wrappers............... | |
| Graces-MacBook-Pro:git_warmup2 RiverGracefish$ mine . | |
| Graces-MacBook-Pro:git_warmup2 RiverGracefish$ bundle | |
| Fetching gem metadata from https://rubygems.org/............ | |
| Resolving dependencies... | |
| Installing ast 2.0.0 | |
| Installing parser 2.2.0.3 | |
| Installing astrolabe 1.3.0 | |
| Installing hitimes 1.2.2 | |
| Installing timers 4.0.1 | |
| Installing celluloid 0.16.0 | |
| Installing coderay 1.1.0 | |
| Installing ffi 1.9.6 | |
| Installing formatador 0.2.5 | |
| Installing rb-fsevent 0.9.4 | |
| Installing rb-inotify 0.9.5 | |
| Installing listen 2.8.5 | |
| Installing lumberjack 1.0.9 | |
| Installing nenv 0.2.0 | |
| Installing shellany 0.0.1 | |
| Installing notiffany 0.0.5 | |
| Installing method_source 0.8.2 | |
| Installing slop 3.6.0 | |
| Installing pry 0.10.1 | |
| Installing thor 0.19.1 | |
| Installing guard 2.12.1 | |
| Installing powerpack 0.1.0 | |
| Installing rainbow 2.0.0 | |
| Installing ruby-progressbar 1.7.1 | |
| Installing rubocop 0.29.1 | |
| Installing guard-rubocop 1.2.0 | |
| Using bundler 1.6.2 | |
| Your bundle is complete! | |
| Use `bundle show [gemname]` to see where a bundled gem is installed. | |
| Graces-MacBook-Pro:git_warmup2 RiverGracefish$ guard init | |
| 19:19:38 - INFO - Writing new Guardfile to /Users/RiverGracefish/workspace/davinci_coders_t1_2015/self_practice/practice/git_warmup2/Guardfile | |
| 19:19:38 - INFO - rubocop guard added to Guardfile, feel free to edit it | |
| Graces-MacBook-Pro:git_warmup2 RiverGracefish$ guard | |
| 19:20:04 - INFO - Inspecting Ruby code style of all files | |
| warning: parser/current is loading parser/ruby21, which recognizes | |
| warning: 2.1.5-compliant syntax, but you are running 2.1.2. | |
| Inspecting 2 files | |
| .C | |
| Offenses: | |
| Guardfile:27:9: C: Use %r only for regular expressions matching more than 1 '/' character. | |
| watch(%r{.+\.rb$}) | |
| ^^^^^^^^^^^ | |
| Guardfile:28:9: C: Use %r only for regular expressions matching more than 1 '/' character. | |
| watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) } | |
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 2 files inspected, 2 offenses detected | |
| 19:20:05 - INFO - Guard is now watching at '/Users/RiverGracefish/workspace/davinci_coders_t1_2015/self_practice/practice/git_warmup2' | |
| [1] guard(main)> exit | |
| 19:20:12 - INFO - Bye bye... | |
| Graces-MacBook-Pro:git_warmup2 RiverGracefish$ guard | |
| 19:21:35 - INFO - Inspecting Ruby code style of all files | |
| warning: parser/current is loading parser/ruby21, which recognizes | |
| warning: 2.1.5-compliant syntax, but you are running 2.1.2. | |
| Inspecting 1 file | |
| . | |
| 1 file inspected, no offenses detected | |
| 19:21:35 - INFO - Guard is now watching at '/Users/RiverGracefish/workspace/davinci_coders_t1_2015/self_practice/practice/git_warmup2' | |
| [1] guard(main)> exit | |
| 19:21:37 - INFO - Bye bye... | |
| Graces-MacBook-Pro:git_warmup2 RiverGracefish$ git init | |
| Initialized empty Git repository in /Users/RiverGracefish/workspace/davinci_coders_t1_2015/self_practice/practice/git_warmup2/.git/ | |
| Graces-MacBook-Pro:git_warmup2 RiverGracefish$ git status | |
| On branch master | |
| Initial commit | |
| Untracked files: | |
| (use "git add <file>..." to include in what will be committed) | |
| .rubocop.yml | |
| .ruby-gemset | |
| .ruby-version | |
| Gemfile | |
| Gemfile.lock | |
| Guardfile | |
| nothing added to commit but untracked files present (use "git add" to track) | |
| Graces-MacBook-Pro:git_warmup2 RiverGracefish$ git add .ru* Gemfile* Guard* | |
| Graces-MacBook-Pro:git_warmup2 RiverGracefish$ git commit -m 'Added initial setup' | |
| [master (root-commit) 828d37f] Added initial setup | |
| 6 files changed, 100 insertions(+) | |
| create mode 100644 .rubocop.yml | |
| create mode 100644 .ruby-gemset | |
| create mode 100644 .ruby-version | |
| create mode 100644 Gemfile | |
| create mode 100644 Gemfile.lock | |
| create mode 100644 Guardfile | |
| Graces-MacBook-Pro:git_warmup2 RiverGracefish$ ruby greeting.rb | |
| What is your name? Phil | |
| Nice to meet you, Phil. | |
| Graces-MacBook-Pro:git_warmup2 RiverGracefish$ ruby greeting.rb | |
| What is your name? lovephilippe | |
| Nice to meet you, Lovephilippe. | |
| Graces-MacBook-Pro:git_warmup2 RiverGracefish$ ruby greeting.rb | |
| What is your name? smile | |
| Nice to meet you, Smile. | |
| Graces-MacBook-Pro:git_warmup2 RiverGracefish$ git add greeting.rb | |
| Graces-MacBook-Pro:git_warmup2 RiverGracefish$ git commit -m 'adding greeting file' | |
| [master c853877] adding greeting file | |
| 1 file changed, 6 insertions(+) | |
| create mode 100644 greeting.rb | |
| Graces-MacBook-Pro:git_warmup2 RiverGracefish$ git remote add origin git@github.com:RiverGracefish/git_self_practice_for_fun_2.git | |
| Graces-MacBook-Pro:git_warmup2 RiverGracefish$ git push -u origin master | |
| Counting objects: 11, done. | |
| Delta compression using up to 8 threads. | |
| Compressing objects: 100% (8/8), done. | |
| Writing objects: 100% (11/11), 1.84 KiB | 0 bytes/s, done. | |
| Total 11 (delta 1), reused 0 (delta 0) | |
| To git@github.com:RiverGracefish/git_self_practice_for_fun_2.git | |
| * [new branch] master -> master | |
| Branch master set up to track remote branch master from origin. | |
| Graces-MacBook-Pro:git_warmup2 RiverGracefish$ ls | |
| Gemfile Gemfile.lock Guardfile greeting.rb | |
| Graces-MacBook-Pro:git_warmup2 RiverGracefish$ cd .. | |
| Graces-MacBook-Pro:practice RiverGracefish$ ls | |
| git git_warmup git_warmup2 | |
| Graces-MacBook-Pro:practice RiverGracefish$ |
code for <Gemfile>
| source 'https://rubygems.org' | |
| gem 'guard-rubocop' | |
| gem 'guard-rspec' |
code for <.rubocop.yml>
| AllCops: | |
| Exclude: | |
| - 'Guardfile' |
Want more practice? Repeat 😉




