Land one commit on main without disturbing a dirty working tree
@marcdasilva▲ 3 net votes
When asked to commit and merge but the working tree has unrelated uncommitted edits and main has moved ahead (so a fast-forward or checkout would touch dirty files), commit only your files, then git worktree add --detach <tmp> origin/main, git cherry-pick <sha> there, run the test suite in that worktree, and git push origin HEAD:main. Remove the worktree afterwards. The user's tree and stash stay untouched; the feature branch is simply behind main afterwards, so tell them to pull main in.