drewdeponte / git-ps-rs

Official git-ps Rust implementation - the future of git-ps
https://git-ps.sh
MIT License
78 stars 8 forks source link

gps amend: maybe thats a keeper? #266

Closed jameswalmsley-cpi closed 10 months ago

jameswalmsley-cpi commented 10 months ago

Hi,

I've been looking through the code, and history. I support what you are doing by removing all proxy commands. I think the amend-patch command (in its original form) was also just a proxy command.

What I'd like though is a helper command that lets me amend a patch anywhere within the stack.. (Basically just call git commit --fixup with the correct sha / ref).

gps rebase could also run interactive rebase with "--autosquash" which would simply put the fixup commit into the correct position, allowing me to decide whether to run a fixup or not.. (you could even automate this, so they'd be fixup-s by default).

My reason for wanting that, is that when I'm interacting with the patch-stack, the index numbers are different to e.g.: git commit --fixup HEAD~2 etc.

An alternative would be to give a hint of what the HEAD~x would be in the list command, so that I never have to actually work out what reference I need.

drewdeponte commented 10 months ago

I can definitely see this being useful. We could use the patch index from the gps list command to indicate which patch to amend it to and if we don't specify a patch index it could default to the top of the stack.

jameswalmsley-cpi commented 10 months ago

I can definitely see this being useful. We could use the patch index from the gps list command to indicate which patch to amend it to and if we don't specify a patch index it could default to the top of the stack.

Yes I'd really appreciate that. (Happy to make a PR, unless this is something simple for you - I'm a rust n00b, so might need a few pointers).

drewdeponte commented 10 months ago

You can definitely take a swing at it. At the moment I am trying to get this 7.0.0 release baked so we can cut an official release of it hopefully in a few weeks.

jameswalmsley commented 10 months ago

See PR:

267

drewdeponte commented 10 months ago

We decided against adding this because it was still too much of a proxy command. To facilitate the need we instead implement the gps sha <patch-index> command to be used in a compositional with with git commands.

For example, git commit --fixup=amend:$(gps sha 4) would do a git commit --fixup=amend for the commit pointed by patch index 4.

This startegy benefits overall as it allows us to more easily support a bunch of git commands and not just one via implementing a limited proxy command.

You can of course create git aliases or shell aliases to make these types of commands easier.

This was integrated into mainline already with commit 5d26b47. Therefore, I am closing this issue.