lab 33 Resetting the Master Branch
Goals
- Reset the master branch to the point before the conflicting commit.
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 * ee34d83 2014-02-21 | La fusion depuis master corrige le conflit (HEAD, master) [Jim Weirich] * 4075c2b 2014-02-21 | Rendre interactif [Jim Weirich] * 5c4b651 2014-02-21 | Ajout d'un README [Jim Weirich] * 6f69f38 2014-02-21 | Ajout d'un Rakefile [Jim Weirich] * c8d6b61 2014-02-21 | Déplacement de bonjour.rb dans lib [Jim Weirich] * 83558be 2014-02-21 | Add an author/email comment [Jim Weirich] * a9c6007 2014-02-21 | Ajout d'un commentaire (v1) [Jim Weirich] * 221243e 2014-02-21 | Ajouter une valeur par défaut (v1-beta) [Jim Weirich] * 80fc666 2014-02-21 | Using ARGV [Jim Weirich] * 834ca4f 2014-02-21 | Mon premier commit [Jim Weirich]
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 * 5c4b651 2014-02-21 | Ajout d'un README (HEAD, master) [Jim Weirich] | * 83b5dc6 2014-02-21 | Rakefile mis à jour (saluer) [Jim Weirich] | * 0560857 2014-02-21 | bonjour utiliser Faireunsalut [Jim Weirich] | * 1e570bd 2014-02-21 | Ajout de la classe Faireunsalut [Jim Weirich] |/ * 6f69f38 2014-02-21 | Ajout d'un Rakefile [Jim Weirich] * c8d6b61 2014-02-21 | Déplacement de bonjour.rb dans lib [Jim Weirich] * 83558be 2014-02-21 | Add an author/email comment [Jim Weirich] * a9c6007 2014-02-21 | Ajout d'un commentaire (v1) [Jim Weirich] * 221243e 2014-02-21 | Ajouter une valeur par défaut (v1-beta) [Jim Weirich] * 80fc666 2014-02-21 | Using ARGV [Jim Weirich] * 834ca4f 2014-02-21 | Mon premier commit [Jim Weirich]