[#2030] Fix PQM merge init.


Problem description
===================

PQM checks if it can merge the branch but then fails to revert the state.




Changes description
===================

Improve code for reverting to previous branch.


How to try and test the changes
===============================

reviewers @adiroiban

Not sure how to test this...