chucklever · GitHub

If there's already a convenient way to do this, please let me know if I'm "doing it wrong". And apologies for being long-winded.

I frequently need to re-order patches in a series. I'm in the zone pushing and popping, and then suddenly I push a patch that doesn't apply cleanly and I realize I can't re-order the series that way without significant changes. But the workspace then needs to be cleaned up because it's full of conflicts, and the patch that didn't apply is now empty. It takes several minutes to hunt down the previous version of the patch, fix up the conflicts, and so on before I can get on with the original task. "stg undo" does not seem capable enough to make this painless (or perhaps I don't understand how to use it).

Instead, I'd like to propose possible tooling changes:

  1. Make "stg undo" behave in a more convenient way -- instead of leaving the conflicts, can it actually undo things to the pre-push state and leave both the patch and the workspace in clean condition?
  2. Add the ability to try out a push instead of actually performing it. Call it "stg try" or "stg push --dry-run", which would attempt to apply the patch and report either "the conflicts would be here and here" or "that will work fine, go ahead for real".
  3. Or, make "stg push" always behave transactionally: if there are conflicts, then it simply fails and leaves the series in its pre-push state (I believe "stg import" behaves this way).
  4. Or, make the default behavior of "stg push" transactional as above, as that as less surprising, but then add a new option to "stg push" that retains the current "just do it and I'll clean up the mess" behavior; say "stg push --force". This possibly adds a step or two when rebasing introduces conflicts in a series, so rebase could continue using "stg push --force".

As always, thanks very much for your efforts!

Read the original on github.com ↗