Git - Resetting the Master Branch

From EdWiki

GitLab - Resetting the Master Branch

  • Goals
    Reset the master branch to the point before the conflicting commit.
  • Reset the master branch

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.

git checkout master
git hist

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

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.