I frequently use "fixup!", "squash!" and "rebase -i" to clean up, correct, or just fiddle with recent, unpushed history. I'd like to find a way to get Git to automatically choose which commit makes the most sense for interactive rebasing, so that I could define an alias to do a quick interactive rebase.
I think the best commit in such cases would be the most recent ancestor to either:
- appear in any other branch (local or remote)
- have more than one parent
- have no parents
The first condition ensures that I don't rewrite commits that might affect others. The second ensures that I don't try to rebase "through" a merge, which is definitely not what I want. The third is just a sanity check.
So the question is, how do I use Git find that commit?