Git - Resetting the Greet Branch

From EdWiki

GitLab - Resetting the Greet Branch

  • Goals
    Reset the greet branch to the point before the first merge.
  • Reset the greet branch

Let’s go back in time on the greet branch to the point before we merged master onto it. We can reset a branch to any commit we want. Essentially this is modifying the branch pointer to point to anywhere in the commit tree.

In this case we want to back greet up to the point prior to the merge with master. We need to find the last commit before the merge.

git checkout greet
git hist

Looking at the data we see that the “Updated Makefile” commit was the last commit on the greet branch before merging. Let’s reset the greet branch to that commit.

git reset --hard <hash>
  • Check the branch.

Look at the log for the greet branch. We no longer have the merge commits in its history.

git hist --all