Git Branching

Creating a new branch and switching over to it is done with the following line of code

> git checkout -b my-second-branch

You can work on this branch now by editing files and when it is time to commit and push to github, all you need is to issue same commands ads if you work with master branch

> git add .

> git commit -m “My message for commit”

Next step is to push from your origin which is now your branched git tree to the branch established on github.

> git push origin my-second-branch

Git Push requires to have origin parameter set. Here is an eaxmple how to set it correctly if you are not done so already

> git remote add origin git@github.com:my-git-name/my-git-repo.git

You can always find what your current branch is by issuing the following command

> git branch

If you realize that you are currently on the wrong branch, you can issue switch statement and move over to branch that you need

> git checkout my-second-branch

 

Featured pages

Ruby

Set of Ruby Object Oriented Programming Language tutorials that cover such topics as Ruby strings, …

Rails

Rails Framework tutorial teaches you how to utilize de facto framework of choice for Ruby developme…

Ruby Duck Typing

“If an object quacks like a duck just go ahead and treat it as a duck” – this fun…

Regular Expressions

Ruby uses the =~ operator to check any given string against regular expression. For example, a stri…

Credit Card Number

Every last digit of any credit card is a check sum digit that is determined by all digits in front …

Ruby Arrays

Ruby Programming Language has built in support for Arrays. Arrays help you define some of the compl…

Ruby Hashes

Hashes are very similar to arrays in Ruby and hashes interface is similar to Ruby array interface. …

Ruby Code Block

Ruby is very unique language when it comes to code blocks. You can simply pass a code block to a me…