Re: Feature Request: Interactively pick fixup revision

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Nov 9, 2context for all your replies. Please also see
below.024 at 2:09 PM <rsbecker@xxxxxxxxxxxxx> 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





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux