Git Branches
Create a new git repository (if you don't already have one)
$ git initCheck existing branches
$ git branch
=> *masterCreate and switch to a new brach
$ git checkout -b newbranchYou have created and switched to the branch newbranch.
Let's mess around a little, create a new file under this branch (unix):
$ touch file.txtAdd the file.txt to git
$ git add .Commit your changes
$ git commit -m "file.txt added"Going back to the master branch
$ git checkout masterNotice that file.txt don't exist under the master branch. You need to merge the newbranch with the master branch to keep everything updated.
$ git merge newbranchNow your master brach have access to file.txt. Check your logs.
$ git logHappy Hacking!
Written by Mariz Melo
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
 #Git 
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#

 
 
 
