* Feature Request: Interactively pick fixup revision
@ 2024-11-09 11:41 Martin Imre
2024-11-09 13:09 ` rsbecker
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Martin Imre @ 2024-11-09 11:41 UTC (permalink / raw)
To: git
Hi,
first email to this list, so please forgive me if I'm doing something wrong.
My usual workflow is using `git commit --fixup <revision>` quite
frequently, as it eases the code reviewing process and allows for a
clean history later on.
One thing that is always cumbersome is to first find the SHA of the
revision that I plan to commit a fixup to.
I usually use git log and then copy the revision.
I even wrote a script that eases this process using fzf:
```
#!/bin/bash
res=$(git log --oneline | fzf)
ref=$(echo $res | cut -d ' ' -f1)
git commit --fixup ${ref}
```
I don't think fzf is really necessary here, but it speeds things up.
Anyhow, I'm really surprised that this isn't a feature of git.
I could see a `git commit --fixup` (without a revision) or `git commit
--fixup --interactive` open up the git log and let one pick the
revision they want to commit a fixup to.
Cheers,
Martin
^ permalink raw reply [flat|nested] 12+ messages in thread* RE: Feature Request: Interactively pick fixup revision
2024-11-09 11:41 Feature Request: Interactively pick fixup revision Martin Imre
@ 2024-11-09 13:09 ` rsbecker
2024-11-09 13:39 ` Martin Imre
2024-11-09 14:55 ` Matěj Cepl
2024-11-09 17:08 ` Kristoffer Haugsbakk
2 siblings, 1 reply; 12+ messages in thread
From: rsbecker @ 2024-11-09 13:09 UTC (permalink / raw)
To: 'Martin Imre', git
On November 9, 2024 6:41 AM, Martin Imre wrote:
>first email to this list, so please forgive me if I'm doing something wrong.
>
>My usual workflow is using `git commit --fixup <revision>` quite frequently, as it
>eases the code reviewing process and allows for a clean history later on.
>
>One thing that is always cumbersome is to first find the SHA of the revision that I
>plan to commit a fixup to.
>I usually use git log and then copy the revision.
>I even wrote a script that eases this process using fzf:
>```
>#!/bin/bash
>
>res=$(git log --oneline | fzf)
>ref=$(echo $res | cut -d ' ' -f1)
>
>git commit --fixup ${ref}
>```
>
>I don't think fzf is really necessary here, but it speeds things up.
>
>Anyhow, I'm really surprised that this isn't a feature of git.
>I could see a `git commit --fixup` (without a revision) or `git commit --fixup --
>interactive` open up the git log and let one pick the revision they want to commit a
>fixup to.
You might find that git rebase --autosquash -i <commit> might do what
you are looking for. This allows you to clean up your topic branch prior
to creating a pull request. Loads of documentation online about its use.
Good luck,
Randall
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: Feature Request: Interactively pick fixup revision
2024-11-09 13:09 ` rsbecker
@ 2024-11-09 13:39 ` Martin Imre
0 siblings, 0 replies; 12+ messages in thread
From: Martin Imre @ 2024-11-09 13:39 UTC (permalink / raw)
To: rsbecker; +Cc: git
On Sat, Nov 9, 2context for all your replies. Please also see
below.024 at 2:09 PM <rsbecker@nexbridge.com> wrote:
>
> On November 9, 2024 6:41 AM, Martin Imre wrote:
> >first email to this list, so please forgive me if I'm doing something wrong.
> >
> >My usual workflow is using `git commit --fixup <revision>` quite frequently, as it
> >eases the code reviewing process and allows for a clean history later on.
> >
> >One thing that is always cumbersome is to first find the SHA of the revision that I
> >plan to commit a fixup to.
> >I usually use git log and then copy the revision.
> >I even wrote a script that eases this process using fzf:
> >```
> >#!/bin/bash
> >
> >res=$(git log --oneline | fzf)
> >ref=$(echo $res | cut -d ' ' -f1)
> >
> >git commit --fixup ${ref}
> >```
> >
> >I don't think fzf is really necessary here, but it speeds things up.
> >
> >Anyhow, I'm really surprised that this isn't a feature of git.
> >I could see a `git commit --fixup` (without a revision) or `git commit --fixup --
> >interactive` open up the git log and let one pick the revision they want to commit a
> >fixup to.
>
> You might find that git rebase --autosquash -i <commit> might do what
> you are looking for. This allows you to clean up your topic branch prior
> to creating a pull request. Loads of documentation online about its use.
>
> Good luck,
> Randall
>
I think you might have misunderstood what I'm trying to achieve.
After adding a fixup commit, I'm anyway running `git rebase
--autosquash -i <commit>`.
However, my request is to get an interactive way to pick _which_
commit a fixup is targeting.
Ie, I'm trying to run something that pops up a pager with the commit
log for me to pick a commit that is then passed to `git commit --fixup
<commit>`.
If you have fzf, try running my script in a git repo with some changes
and you'll see what I'm trying to achieve.
Cheers,
Martin
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Feature Request: Interactively pick fixup revision
2024-11-09 11:41 Feature Request: Interactively pick fixup revision Martin Imre
2024-11-09 13:09 ` rsbecker
@ 2024-11-09 14:55 ` Matěj Cepl
2024-11-09 17:13 ` Kristoffer Haugsbakk
2024-11-09 17:08 ` Kristoffer Haugsbakk
2 siblings, 1 reply; 12+ messages in thread
From: Matěj Cepl @ 2024-11-09 14:55 UTC (permalink / raw)
To: Martin Imre, git
[-- Attachment #1.1.1: Type: text/plain, Size: 751 bytes --]
On Sat Nov 9, 2024 at 12:41 PM CET, Martin Imre wrote:
> My usual workflow is using `git commit --fixup <revision>` quite
> frequently, as it eases the code reviewing process and allows for a
> clean history later on.
https://github.com/keis/git-fixup/
but at least as a minimal improvement, I would limit list of
commits to those which are touched in the staging area:
ref=$(git log --oneline -- $(git diff --cached|lsdiff --strip 1)|fzf|cut -d ' ' -f1)
(lsdiff is from patchutils)
Best,
Matěj
--
http://matej.ceplovi.cz/blog/, @mcepl@floss.social
GPG Finger: 3C76 A027 CA45 AD70 98B5 BC1D 7920 5802 880B C9D8
Ty zlý dávaj’ ty hodný pryč. // Those evil ones put away those good ones.
-- Magda Ceplová
[-- Attachment #1.2: E09FEF25D96484AC.asc --]
[-- Type: application/pgp-keys, Size: 3102 bytes --]
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQGiBD2g5T0RBACZdnG/9T4JS2mlxsHeFbex1KWweKPuYTpnbu8Fe7rNYMWZ/AKc
9Vm+RuoVErm4HGsb0pL5ZPnncA+m80W8EzQm2rs8PD2mHNsUhDOGnk+0fm+25WSU
6YLzd8lttxPia75A5OqBEAmJlyJUSmoWKjAK/q1Tj5HW3+/7XqWYYCJzAwCgjR2D
irw8QP8GCoUUXxeNpIOTqzMD/j66VTln+rxYT12U4jxLlsOs5Y0LVQfUbpDFEYy9
mkWX8iNTUZsx+m6uhylamm3EkN/dW0b2sQ4D3ocZekriLPDR/X0P1XPUdcy28a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gEGFQgCCQoLBBYCAwEC
HgECF4AACgkQ4J/vJdlkhKyKtQCdHDpolHg/1qDaw/4CQyUzAfNvHk0AniEYL6BF
rdyonhgQf/ZXzXjnKzSeuQENBD2g5UEQBACfxoz2nmzGJz6ueKHkTeXcQZvK4WzK
TN/uJJhEmSuQmOKymbIkGL6vBQb+W4KxvLl2lAbNlfIgLGDLCs1YAwfSpJ4vS4mt
liPgA2OtZ5j1WSOqpxedQPGVba5gVo7HNSOMUtZKTz7VsCvR94v05comhO1Gok75
ZxHtYyVHuk5V8wADBQP/ft+W4F0tccwslzz8O/c9/Mj8KZDYmfMyNb7ielT2WeQ3
iFF9AxMT6OvOxAQbDJvurfKeYlydcXLs6cy4lKce1hFaJ4i+MOFLVV1ZnZDDChRP
pQ6KrRCHLb+mLY+SYD37O7p0spQA+9gsEE/tmn+5sW7LE8hqSOoPVdf7Y5yUDj6I
RgQYEQIABgUCPaDlQQAKCRDgn+8l2WSErEUSAJ42T1l/2TFykbULBqqAtnbC6kR0
wwCdEnRlCGlvnO78R0FgKXlt3RyzGuE=
=sxoW
-----END PGP PUBLIC KEY BLOCK-----
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 216 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Feature Request: Interactively pick fixup revision
2024-11-09 14:55 ` Matěj Cepl
@ 2024-11-09 17:13 ` Kristoffer Haugsbakk
2024-11-09 19:43 ` Matěj Cepl
0 siblings, 1 reply; 12+ messages in thread
From: Kristoffer Haugsbakk @ 2024-11-09 17:13 UTC (permalink / raw)
To: Matěj Cepl, Martin Imre, git
On Sat, Nov 9, 2024, at 15:55, Matěj Cepl wrote:
> On Sat Nov 9, 2024 at 12:41 PM CET, Martin Imre wrote:
>> My usual workflow is using `git commit --fixup <revision>` quite
>> frequently, as it eases the code reviewing process and allows for a
>> clean history later on.
>
> https://github.com/keis/git-fixup/
>
> but at least as a minimal improvement, I would limit list of
> commits to those which are touched in the staging area:
>
> ref=$(git log --oneline -- $(git diff --cached|lsdiff --strip
> 1)|fzf|cut -d ' ' -f1)
>
> (lsdiff is from patchutils)
This or git-absorb(1) (I have only tried the latter) is good if you want
to fixup previously touched lines. That is likely to be the case for a
fixup command. But maybe you for example want to add a test to some
change which is in a different file. In which case you want to pick the
commit manually.
I haven’t heard of lsdiff(1) though. That’s something I have been
wanting lately. Thanks.
--
Kristoffer Haugsbakk
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Feature Request: Interactively pick fixup revision
2024-11-09 17:13 ` Kristoffer Haugsbakk
@ 2024-11-09 19:43 ` Matěj Cepl
2024-11-10 7:55 ` Martin Imre
0 siblings, 1 reply; 12+ messages in thread
From: Matěj Cepl @ 2024-11-09 19:43 UTC (permalink / raw)
To: Kristoffer Haugsbakk, Martin Imre, git
[-- Attachment #1.1.1: Type: text/plain, Size: 582 bytes --]
On Sat Nov 9, 2024 at 6:13 PM CET, Kristoffer Haugsbakk wrote:
> I haven’t heard of lsdiff(1) though. That’s something I have been
> wanting lately. Thanks.
https://github.com/twaugh/patchutils (part of any Linux distro)
… it is absolutely indispensable set of tools for any developer,
IMHO.
Matěj
--
http://matej.ceplovi.cz/blog/, @mcepl@floss.social
GPG Finger: 3C76 A027 CA45 AD70 98B5 BC1D 7920 5802 880B C9D8
The state is the great fictitious entity by which everyone seeks
to live at the expense of everyone else.
-- Frederick Bastiat
[-- Attachment #1.2: E09FEF25D96484AC.asc --]
[-- Type: application/pgp-keys, Size: 3102 bytes --]
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQGiBD2g5T0RBACZdnG/9T4JS2mlxsHeFbex1KWweKPuYTpnbu8Fe7rNYMWZ/AKc
9Vm+RuoVErm4HGsb0pL5ZPnncA+m80W8EzQm2rs8PD2mHNsUhDOGnk+0fm+25WSU
6YLzd8lttxPia75A5OqBEAmJlyJUSmoWKjAK/q1Tj5HW3+/7XqWYYCJzAwCgjR2D
irw8QP8GCoUUXxeNpIOTqzMD/j66VTln+rxYT12U4j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IkPodxr1nCvJbtBpNYXRlaiBDZXBsIDxtY2Vw
bEBzdXNlLmN6PohjBBMRAgAjBQJa+uRPAhsDBwsJCAcDAgEGFQgCCQoLBBYCAwEC
HgECF4AACgkQ4J/vJdlkhKyKtQCdHDpolHg/1qDaw/4CQyUzAfNvHk0AniEYL6BF
rdyonhgQf/ZXzXjnKzSeuQENBD2g5UEQBACfxoz2nmzGJz6ueKHkTeXcQZvK4WzK
TN/uJJhEmSuQmOKymbIkGL6vBQb+W4KxvLl2lAbNlfIgLGDLCs1YAwfSpJ4vS4mt
liPgA2OtZ5j1WSOqpxedQPGVba5gVo7HNSOMUtZKTz7VsCvR94v05comhO1Gok75
ZxHtYyVHuk5V8wADBQP/ft+W4F0tccwslzz8O/c9/Mj8KZDYmfMyNb7ielT2WeQ3
iFF9AxMT6OvOxAQbDJvurfKeYlydcXLs6cy4lKce1hFaJ4i+MOFLVV1ZnZDDChRP
pQ6KrRCHLb+mLY+SYD37O7p0spQA+9gsEE/tmn+5sW7LE8hqSOoPVdf7Y5yUDj6I
RgQYEQIABgUCPaDlQQAKCRDgn+8l2WSErEUSAJ42T1l/2TFykbULBqqAtnbC6kR0
wwCdEnRlCGlvnO78R0FgKXlt3RyzGuE=
=sxoW
-----END PGP PUBLIC KEY BLOCK-----
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 216 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: Feature Request: Interactively pick fixup revision
2024-11-09 19:43 ` Matěj Cepl
@ 2024-11-10 7:55 ` Martin Imre
2024-11-10 7:59 ` Kristoffer Haugsbakk
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Martin Imre @ 2024-11-10 7:55 UTC (permalink / raw)
To: Matěj Cepl; +Cc: Kristoffer Haugsbakk, git
Thanks for pointing me towards https://github.com/keis/git-fixup/ and
git-absorb (https://github.com/tummychow/git-absorb).
I'll try them out and see if I like the ergonomics of them.
Just as a general question: With 2 (or even more) different
implementations that solve the same problem, wouldn't this be a good
addition for a future version of git?
Also, out of curiosity, how do they achieve their binaries to be
called as git commands, ie, why can I call the binary `git-fixup` via
`git fixup`?
Cheers,
Martin
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: Feature Request: Interactively pick fixup revision
2024-11-10 7:55 ` Martin Imre
@ 2024-11-10 7:59 ` Kristoffer Haugsbakk
2024-11-10 16:09 ` Stefan Haller
2024-11-11 2:53 ` Matěj Cepl
2 siblings, 0 replies; 12+ messages in thread
From: Kristoffer Haugsbakk @ 2024-11-10 7:59 UTC (permalink / raw)
To: Martin Imre, Matěj Cepl; +Cc: git
On Sun, Nov 10, 2024, at 08:55, Martin Imre wrote:
> Also, out of curiosity, how do they achieve their binaries to be
> called as git commands, ie, why can I call the binary `git-fixup` via
> `git fixup`?
They don’t do anything special. Any script or binary that you define
yourself will be treated the same. `git` takes care of it.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Feature Request: Interactively pick fixup revision
2024-11-10 7:55 ` Martin Imre
2024-11-10 7:59 ` Kristoffer Haugsbakk
@ 2024-11-10 16:09 ` Stefan Haller
2024-11-11 2:53 ` Matěj Cepl
2 siblings, 0 replies; 12+ messages in thread
From: Stefan Haller @ 2024-11-10 16:09 UTC (permalink / raw)
To: Martin Imre; +Cc: git
On 10.11.24 08:55, Martin Imre wrote:
> Thanks for pointing me towards https://github.com/keis/git-fixup/ and
> git-absorb (https://github.com/tummychow/git-absorb).
> I'll try them out and see if I like the ergonomics of them.
>
> Just as a general question: With 2 (or even more) different
> implementations that solve the same problem, wouldn't this be a good
> addition for a future version of git?
I'll throw a third one into the mix: lazygit. It's a TUI client that has
similar functionality built in. (See [1])
As for why this isn't built in: there are a lot of subtleties to how
exactly it works, and people might not agree on these. For example,
git-absorb seems to have certain design goals that I don't agree with; I
have written a longish document about that if you're interested. [2]
[1] <https://github.com/jesseduffield/lazygit/blob/master/
docs/Fixup_Commits.md#finding-the-commit-to-create-a-fixup-for>
[2] <https://github.com/jesseduffield/lazygit/blob/master/docs/
dev/Find_Base_Commit_For_Fixup_Design.md>
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: Feature Request: Interactively pick fixup revision
2024-11-10 7:55 ` Martin Imre
2024-11-10 7:59 ` Kristoffer Haugsbakk
2024-11-10 16:09 ` Stefan Haller
@ 2024-11-11 2:53 ` Matěj Cepl
2024-11-16 17:39 ` Oswald Buddenhagen
2 siblings, 1 reply; 12+ messages in thread
From: Matěj Cepl @ 2024-11-11 2:53 UTC (permalink / raw)
To: Martin Imre; +Cc: Kristoffer Haugsbakk, git
[-- Attachment #1.1.1: Type: text/plain, Size: 1173 bytes --]
On Sun Nov 10, 2024 at 8:55 AM CET, Martin Imre wrote:
> Just as a general question: With 2 (or even more) different
> implementations that solve the same problem, wouldn’t this be a good
> addition for a future version of git?
There are few problems, one which is the implementation language:
git-absorb is Rust and git-fixup is bash (using arrays and other
non-POSIX constructs).
Documentation/howto/new-command.txt declares:
Most subcommands are written in C or shell. A few are written in
Perl.
(And Python scripts are allowed for some specific tasks, namely GUI)
Shell script here quite emphatically means POSIX shell (or at
least not using widely non-POSIX constructs like arrays), not
bash. In order to even be able to consider any of these commands
to be submitted to git proper, it would have to be ported first.
Best,
Matěj
--
http://matej.ceplovi.cz/blog/, @mcepl@floss.social
GPG Finger: 3C76 A027 CA45 AD70 98B5 BC1D 7920 5802 880B C9D8
Never ascribe to malice that which is adequately explained by
stupidity.
-- Napoleon Bonaparte (or many other people to whom this
quote is ascribed)
[-- Attachment #1.2: E09FEF25D96484AC.asc --]
[-- Type: application/pgp-keys, Size: 3102 bytes --]
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQGiBD2g5T0RBACZdnG/9T4JS2mlxsHeFbex1KWweKPuYTpnbu8Fe7rNYMWZ/AKc
9Vm+RuoVErm4HGsb0pL5ZPnncA+m80W8EzQm2rs8PD2mHNsUhDOGnk+0fm+25WSU
6YLzd8lttxPia75A5OqBEAmJlyJUSmoWKjAK/q1Tj5HW3+/7XqWYYCJ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sQQCdGmGXW73O6Q3TB0V0
xP9yLwMjDtEAnjKWDW8PKO90nx8IkPodxr1nCvJbtBpNYXRlaiBDZXBsIDxtY2Vw
bEBzdXNlLmN6PohjBBMRAgAjBQJa+uRPAhsDBwsJCAcDAgEGFQgCCQoLBBYCAwEC
HgECF4AACgkQ4J/vJdlkhKyKtQCdHDpolHg/1qDaw/4CQyUzAfNvHk0AniEYL6BF
rdyonhgQf/ZXzXjnKzSeuQENBD2g5UEQBACfxoz2nmzGJz6ueKHkTeXcQZvK4WzK
TN/uJJhEmSuQmOKymbIkGL6vBQb+W4KxvLl2lAbNlfIgLGDLCs1YAwfSpJ4vS4mt
liPgA2OtZ5j1WSOqpxedQPGVba5gVo7HNSOMUtZKTz7VsCvR94v05comhO1Gok75
ZxHtYyVHuk5V8wADBQP/ft+W4F0tccwslzz8O/c9/Mj8KZDYmfMyNb7ielT2WeQ3
iFF9AxMT6OvOxAQbDJvurfKeYlydcXLs6cy4lKce1hFaJ4i+MOFLVV1ZnZDDChRP
pQ6KrRCHLb+mLY+SYD37O7p0spQA+9gsEE/tmn+5sW7LE8hqSOoPVdf7Y5yUDj6I
RgQYEQIABgUCPaDlQQAKCRDgn+8l2WSErEUSAJ42T1l/2TFykbULBqqAtnbC6kR0
wwCdEnRlCGlvnO78R0FgKXlt3RyzGuE=
=sxoW
-----END PGP PUBLIC KEY BLOCK-----
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 216 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: Feature Request: Interactively pick fixup revision
2024-11-11 2:53 ` Matěj Cepl
@ 2024-11-16 17:39 ` Oswald Buddenhagen
0 siblings, 0 replies; 12+ messages in thread
From: Oswald Buddenhagen @ 2024-11-16 17:39 UTC (permalink / raw)
To: mcepl; +Cc: git, kristofferhaugsbakk, martinimre25
On Mon, 11 Nov 2024 03:53:47 +0100, Matěj Cepl wrote:
> On Sun Nov 10, 2024 at 8:55 AM CET, Martin Imre wrote:
> > Just as a general question: With 2 (or even more) different
> > implementations that solve the same problem, wouldn’t this be a good
> > addition for a future version of git?
>
> There are few problems, one which is the implementation language:
> git-absorb is Rust and git-fixup is bash (using arrays and other
> non-POSIX constructs).
>
fwiw, i just stumbled over https://github.com/torbiak/git-autofixup
which is written in perl. no idea how good it is compared to git-absorb.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Feature Request: Interactively pick fixup revision
2024-11-09 11:41 Feature Request: Interactively pick fixup revision Martin Imre
2024-11-09 13:09 ` rsbecker
2024-11-09 14:55 ` Matěj Cepl
@ 2024-11-09 17:08 ` Kristoffer Haugsbakk
2 siblings, 0 replies; 12+ messages in thread
From: Kristoffer Haugsbakk @ 2024-11-09 17:08 UTC (permalink / raw)
To: Martin Imre, git
On Sat, Nov 9, 2024, at 12:41, Martin Imre wrote:
> Hi,
>
> first email to this list, so please forgive me if I'm doing something wrong.
>
> My usual workflow is using `git commit --fixup <revision>` quite
> frequently, as it eases the code reviewing process and allows for a
> clean history later on.
>
> One thing that is always cumbersome is to first find the SHA of the
> revision that I plan to commit a fixup to.
> I usually use git log and then copy the revision.
> I even wrote a script that eases this process using fzf:
> ```
> #!/bin/bash
>
> res=$(git log --oneline | fzf)
> ref=$(echo $res | cut -d ' ' -f1)
>
> git commit --fixup ${ref}
> ```
>
> I don't think fzf is really necessary here, but it speeds things up.
>
> Anyhow, I'm really surprised that this isn't a feature of git.
> I could see a `git commit --fixup` (without a revision) or `git commit
> --fixup --interactive` open up the git log and let one pick the
> revision they want to commit a fixup to.
>
> Cheers,
> Martin
This could be useful for a lot of commands. I use git-notes(1) a lot
(just as a niche example). I often wanna just get a list of the last
commits (e.g. `@{u}..`) when I want to edit a note. (I should try to
use fzf for that, thanks by the way!)
I’m imagining that some RFC implementation of this could get replies
like “but why just for `git commit --fixup/--squash…`?”
As far as third-party programs are concerned: see this section of the
Lazygit readme:[1]
> Pressing shift+a on any commit will amend that commit with the
> currently staged changes (running an interactive rebase in the
> background).
Not the exact same thing of course. You don’t get intermediary fixup
commit since it just runs interactive rebase in the background (so it
runs an uninteractive rebase…).
I haven’t tried Lazygit myself.
🔗 1: https://github.com/jesseduffield/lazygit
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2024-11-16 17:39 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-09 11:41 Feature Request: Interactively pick fixup revision Martin Imre
2024-11-09 13:09 ` rsbecker
2024-11-09 13:39 ` Martin Imre
2024-11-09 14:55 ` Matěj Cepl
2024-11-09 17:13 ` Kristoffer Haugsbakk
2024-11-09 19:43 ` Matěj Cepl
2024-11-10 7:55 ` Martin Imre
2024-11-10 7:59 ` Kristoffer Haugsbakk
2024-11-10 16:09 ` Stefan Haller
2024-11-11 2:53 ` Matěj Cepl
2024-11-16 17:39 ` Oswald Buddenhagen
2024-11-09 17:08 ` Kristoffer Haugsbakk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox