Resetting the branch style to the point prior to the first merge.
Let us go to the style branch to the point before we merged it with the master branch. We can reset the branch to any commit. In fact, reset can change the branch pointer to point to any commit in the tree.
Here, we want to go back in the style branch to a point before merging with the master. We have to find the last commit prior to the merge.
RUN:
git checkout style
git hist
RESULT:
$ git checkout style
Already on 'style'
$ git hist
* 645c4e6 2020-01-09 | Merged master fixed conflict. (HEAD, style) [kwikl3arn]
|\
| * 454ec68 2020-01-09 | Life is great! (master) [kwikl3arn]
* | 5813a3f 2020-01-09 | Merge branch 'master' into style [kwikl3arn]
|\ \
| |/
| * 6c0f848 2020-01-09 | Added README [kwikl3arn]
* | 07a2a46 2020-01-09 | Updated index.html [kwikl3arn]
* | 649d26c 2020-01-09 | Hello uses style.css [kwikl3arn]
* | 1f3cbd2 2020-01-09 | Added css stylesheet [kwikl3arn]
|/
* 8029c07 2020-01-09 | Added index.html. [kwikl3arn
* 567948a 2020-01-09 | Moved hello.html to lib [kwikl3arn]
* 6a78635 2020-01-09 | Add an author/email comment [kwikl3arn]
* fa3c141 2020-01-09 | Added HTML header (v1) [kwikl3arn]
* 8c32287 2020-01-09 | Added standard HTML page tags (v1-beta) [kwikl3arn]
* 43628f7 2020-01-09 | Added h1 tag [kwikl3arn]
* 911e8c9 2020-01-09 | First Commit [kwikl3arn]
It's a little hard to read, but we can see from the output that the Updated index.html commit was the latest on the style branch prior to merging. Let us reset the style branch to this commit.
RUN:
git reset --hard <hash>
RESULT:
$ git reset --hard 07a2a46
HEAD is now at 07a2a46 Updated index.html
Look for the style branch log. There are no merge commits in our history.
RUN:
git hist --all
RESULT:
$ git hist --all
* 454ec68 2020-01-09 | Life is great! (master) [kwikl3arn]
* 6c0f848 2020-01-09 | Added README [kwikl3arn]
| * 07a2a46 2020-01-09 | Updated index.html (HEAD, style) [kwikl3arn]
| * 649d26c 2020-01-09 | Hello uses style.css [kwikl3arn]
| * 1f3cbd2 2020-01-09 | Added css stylesheet [kwikl3arn]
|/
* 8029c07 2020-01-09 | Added index.html. [kwikl3arn]
* 567948a 2020-01-09 | Moved hello.html to lib [kwikl3arn]
* 6a78635 2020-01-09 | Add an author/email comment [kwikl3arn]
* fa3c141 2020-01-09 | Added HTML header (v1) [kwikl3arn]
* 8c32287 2020-01-09 | Added standard HTML page tags (v1-beta) [kwikl3arn]
* 43628f7 2020-01-09 | Added h1 tag [kwikl3arn]
* 911e8c9 2020-01-09 | First Commit [kwikl3arn]