If I checkout a branch `a` from main branch, and I have made many changes on `a` branch. But the main branch revert some commits for some reasons. How can I merge `a` branch's changes to main branch the right way?