I would recommend not doing anything complicated such as git rebase and just add more commits, patches (git diff / apply), or merges until your code works. If the number of commits is large, it doesn’t really matter. Optimizing for a pretty looking git history is probably the most foolish thing to focus on.
If you are doing anything that involves rewriting the history you are doing it wrong.
If you are doing anything that involves rewriting the history you are doing it wrong.