Getting ready

Again, we'll use the hello world repository. Make a fresh clone of the repository, or reset the master branch if you have already cloned one.

We can create a fresh clone as follows:

$ git clone https://github.com/PacktPublishing/Git-Version-Control-Cookbook-Second-Edition_hello_world_cookbook.git 
$ cd Git-Version-Control-Cookbook-Second-Edition_hello_world_cookbook

We can reset the existing clone as follows:

$ cd Git-Version-Control-Cookbook-Second-Edition_hello_world_cookbook
$ git checkout master
$ git reset --hard origin/master

HEAD is now at 3061dc6 Adds Java version of 'hello world'

In this example, we also need to use some of the other branches in the repository, so we need to create them locally:

$ git branch -f feature/p-lang origin/feature/p-lang 
Branch feature/p-lang set up to track remote branch feature/p-lang from origin. 

$ git checkout develop 
Switched to branch 'develop' 
Your branch is up-to-date with 'origin/develop'. 

$ git reset --hard origin/develop 
HEAD is now at a95abc6 Adds Groovy hello world 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.172.252