From: "Kristoffer Haugsbakk" <kristofferhaugsbakk@fastmail.com>
To: "Martin Imre" <martinimre25@gmail.com>, git@vger.kernel.org
Subject: Re: Feature Request: Interactively pick fixup revision
Date: Sat, 09 Nov 2024 18:08:36 +0100 [thread overview]
Message-ID: <1d383dbd-a409-4199-84bc-652784835167@app.fastmail.com> (raw)
In-Reply-To: <CABg7He2asYQbdRvSvfh1YZ2FRPchVfvta8yBv4PFdVNnhzX6Ow@mail.gmail.com>
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
prev parent reply other threads:[~2024-11-09 17:08 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1d383dbd-a409-4199-84bc-652784835167@app.fastmail.com \
--to=kristofferhaugsbakk@fastmail.com \
--cc=git@vger.kernel.org \
--cc=martinimre25@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox