stgit icon indicating copy to clipboard operation
stgit copied to clipboard

"stg pick -B" vs "stg series -b"

Open palves opened this issue 4 months ago • 2 comments

This has annoyed me for years and years (since stgit v0.x for sure, I've been using stgit for a decade now), and I finally decided to open a ticket...

stg series has:

Options:
  -b, --branch <branch>
          Use <branch> instead of current branch

while stg pick has:

  -B, --ref-branch <branch>
          Pick patches from <branch>

I run into this all the time with something like:

$ stg series -d -b some-branch
+ patch-1 # me, pick me!
> patch-2 # not me...
$ stg pick patch-1 -b some-branch
error: unexpected argument '-b' found

... and then going like "oh, no, I forgot it's -B again."

I didn't look at all the commands, but I think -b is more prevalent. E.g. "stg delete -b ..."

Can we make "stg pick -b branch" do the right thing, please?

Maybe keep -B as backwards compat alias if you're worried about breaking scripts.

palves avatar Sep 02 '25 12:09 palves

Gosh, all this time, and I never realized the reason for the distinction, until 1 minute after filing this. Classic rubberduck.

"stg foo -b branch" operates on the series of "branch". While "stg pick patch -B branch" picks a patch from branch, and adds it to the series of the current branch. I guess it could make sense to support "stg pick patch -b branch1 -B branch2", make it pick "patch" from branch2, and push it to "branch1", I suppose.

Bleh, I guess I may need to keep remembering to uppercase -B...

palves avatar Sep 02 '25 12:09 palves

Ha, yes, there is a semantic difference between -b and -B as you've discovered. It is somewhat subtle though. Perhaps there is an opportunity to clarify the docs? I'm open to a PR.

jpgrayson avatar Sep 04 '25 13:09 jpgrayson