Many times due to unwanted push/pull/merge your branch mess up with unwanted code. Some unncessary and buggy commits line up in your branch's commit history.
In this case you wish to create new branch from last correct commit.
The naive approach is to hard reset the branch to specific commit, then create a new branch. 😏
But hold on.... You can accomplish that without the resetting stuff. 😎
Here are the steps :
git log: Get the ID of commit which you want to create new branch from.
git checkout -b <branch_name> <commit_id>
And there you go... 🎉
Now you have created a new branch based of the
commit_id that was entered in the command.