lab 33 Resetting the Master Branch

Goals

Reset the master branch 01

When we added the interactive mode to the master branch, we made a change that conflicted with changes in the greet branch. Let’s rewind the master branch to a point before the conflicting change. This allows us to demonstrate the rebase command without worrying about conflicts.

Execute:

git checkout master
git hist

Output:

$ git hist
* 2957100 2013-10-06 | Made interactive (HEAD, master) [Ismail Dhorat]
* 313c04d 2013-10-06 | Added README [Ismail Dhorat]
* b3e19a3 2013-10-06 | Added a Rakefile. [Ismail Dhorat]
* 14f09c0 2013-10-06 | Moved hello.rb to lib [Ismail Dhorat]
* 1fed2ec 2013-10-06 | Add an author/email comment [Ismail Dhorat]
* dc44f2e 2013-10-06 | Added a comment (v1) [Ismail Dhorat]
* 5ec54fd 2013-10-06 | Added a default value (v1-beta) [Ismail Dhorat]
* e606a20 2013-10-06 | Using ARGV [Ismail Dhorat]
* 5d95e74 2013-10-06 | First Commit [Ismail Dhorat]

The ‘Added README’ commit is the one directly before the conflicting interactive mode. We will reset the master branch to ‘Added README’ branch.

Execute:

git reset --hard <hash>
git hist --all

Review the log. It should look like the repository has been wound back in time to the point before we merged anything.

Output:

$ git hist --all
* 7a5c511 2013-10-06 | Updated Rakefile (greet) [Ismail Dhorat]
* 815cf27 2013-10-06 | Hello uses Greeter [Ismail Dhorat]
* 209ff42 2013-10-06 | Added greeter class [Ismail Dhorat]
| * 313c04d 2013-10-06 | Added README (HEAD, master) [Ismail Dhorat]
|/  
* b3e19a3 2013-10-06 | Added a Rakefile. [Ismail Dhorat]
* 14f09c0 2013-10-06 | Moved hello.rb to lib [Ismail Dhorat]
* 1fed2ec 2013-10-06 | Add an author/email comment [Ismail Dhorat]
* dc44f2e 2013-10-06 | Added a comment (v1) [Ismail Dhorat]
* 5ec54fd 2013-10-06 | Added a default value (v1-beta) [Ismail Dhorat]
* e606a20 2013-10-06 | Using ARGV [Ismail Dhorat]
* 5d95e74 2013-10-06 | First Commit [Ismail Dhorat]

Table of Contents