ejoffe / spr

Stacked Pull Requests on GitHub
MIT License
794 stars 68 forks source link

amended to the wrong commit #363

Closed kilianyp closed 11 months ago

kilianyp commented 11 months ago

I wanted to try spr as I really like the concept of it.

How would I resolve following issue:

I accidentally amended the linting fix to Commit B, but now I can't apply the fix again for Commit A and the CI is failing there.

I tried to manually apply the linting to Commit A using git commit --amend, but now git spr update doesn't see that commit somehow.

commit 77761fe286da7fe383d2d7651c9c061b6627b232 (origin/spr/master/65950518)
Author: 

    Ref: Commit B (correctly linted)

commit 9f166a711558f22d27e5a257f8dc531613c1d482
Author: 

    Ref: Commit A (Badly linted)

commit ad5fa3b5043dbe631ef565e4fe1ca96c48fe9e36 (origin/master, origin/HEAD)
Author: 

   Master 
git spr status
rake: config file /home/kilian/.spr.yml not found
> git rev-parse --show-toplevel
> github fetch pull requests
> git log --format=medium --no-color origin/master..HEAD
> git branch --no-color

 ┌─ github checks pass
 │ ┌── pull request approved
 │ │ ┌─── no merge conflicts
 │ │ │ ┌──── stack check
 │ │ │ │
[✅➖✅✅] ⚠️ /pull/200 : Commit B
ejoffe commented 11 months ago

git commit --amend : has issues and shouldn't be used when running with git spr. The issue stems from the way commit-ids are added to the commit message. If my memory is correct, using the --amend flag doesn't allow for adding this commit id. Managing a stack does require to know where to amend fixes, and at times I also have this situation. The easy way out is to combine the two commits into one. I do this by running 'git rebate -i ...' a marking commits as fixup. This will combine the two prs into one and unblock you. The hard approach requires some git vizardry that is not in the scope of this issue, but you basically has to edit commits which can also be done using git rebase, and move the code from one commit to the other.

kilianyp commented 11 months ago

thanks for clarifiying 👍