keith / git-pile

Stacked diff support for GitHub workflows
MIT License
148 stars 11 forks source link

Abort cherry pick if cherry picked commit is empty #12

Closed keith closed 2 years ago

keith commented 2 years ago

In the case the branch you're updating already has the changes of the commit you're trying to add to the pr, the cherry pick will result in no changes, and cherry-pick --continue will fail. In this case we now error because it's likely unexpected. Theoretically we could --allow-empty instead, so that the commits were still squashed together on your main branch, but I imagine it's more common that this was an error.

I hit this case when I reverted a commit on main, and then reverted the revert, and tried to add it to my PR, in that case the PR already had the change from before the revert on the main branch. The fix in my case was to first rebase my PR to get the revert, and then update the PR.