Skip to content

Make submit work with 'git rebase -i' #88

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jansel
Copy link

@jansel jansel commented May 30, 2025

My workflow is I have a bunch of commits, say:

C
B
A

but I only want to submit A and B. So I run:

  1. git rebase -i, stop to edit B
  2. stack-pr submit
  3. git rebase --continue

This was broken, because

  • A rebase in progress makes the git rebase command issued by stack-pr fail
  • Being in a detatched head state wasn't handled well

This PR fixes those. cc @ZolotukhinM

@ZolotukhinM
Copy link
Contributor

Hey @jansel ! I'm a bit worried going into a territory of making stack-pr work with detached head state.

I was wondering if your workflow would be best served by -H option - it was implemented for exactly that. It is not as widely used as the default mode, so I woudln't be surprised if there are some bugs in it though.

The idea is that you can tell stack-pr what range of commits consider for the stack, e.g. if you have 5 commits, but only want to submit PRs for first three, you would use:

stack-pr -H HEAD~2

@jansel
Copy link
Author

jansel commented Jun 8, 2025

I suspect -H would work, though I already use git rebase -i heavily in my current workflows (for more things than just stack-pr), so it would be annoying to need to go up to the top of the stack to submit changes. I will likely continue using my fork of stack-pr that supports this.

The current state of git rebase -i + stack-pr submit (before this change) is:

  1. It updates PRs on github
  2. It leaves your local git in a broken state
  3. It fails with a git error, but doesn't actually print out the error so you have no idea what is going on or why it failed

So if this isn't something you want to support, I'd suggest adding a check and bailing out earlier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants