This is what helped me:
Create a new branch with the existing one. Let's call the existing one branch_old
and new as branch_new
.
Reset branch_new
to a stable state, when you did not have any problem commit at all.
For example, to put it at your local master's level do the following:
git reset —hard master git push —force origin
cherry-pick
the commits from branch_old
into branch_new
git push