git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Carlo Arenas <carenas@gmail.com>
To: Aidan Gallagher <aidgal2@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Feature Request: `git commit --amend-to`
Date: Fri, 24 Sep 2021 10:15:20 -0700	[thread overview]
Message-ID: <CAPUEspgr71t-thozi+Ez4xwxAkSJizsLuV=0TnROKZ85M6-kBg@mail.gmail.com> (raw)
In-Reply-To: <CAENgTz0st6RpnVusP67-SSh2eENSxQn1_qiEqUDiMKzg=r54vQ@mail.gmail.com>

On Fri, Sep 24, 2021 at 9:08 AM Aidan Gallagher <aidgal2@gmail.com> wrote:
> I have solved this issue for myself with this handy alias I found online
> ```
> git config --global alias.amend-to '!f() { SHA=`git rev-parse "$1"`;
> git commit --fixup "$SHA" && GIT_SEQUENCE_EDITOR=true git rebase
> --interactive --autosquash "$SHA^"; }; f'
> ```

since v2.31.0 you can do instead :

  git commit --fixup reword:$SHA && EDITOR=true git rebase
--interactive --autosquash "$SHA^"

granted it is not 1 command, but usually I find it useful to do
several of those and then one single
rebase at the end.

Carlo

  reply	other threads:[~2021-09-24 17:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAENgTz2DoStQEqoKYKa-qMcyaez64u55mnv1HHOzDm392fuEqQ@mail.gmail.com>
2021-09-24 16:04 ` Feature Request: `git commit --amend-to` Aidan Gallagher
2021-09-24 17:15   ` Carlo Arenas [this message]
2021-09-28 16:52     ` Glen Choo
2021-09-28 19:54       ` Ævar Arnfjörð Bjarmason
2021-09-29 16:55         ` Glen Choo
2021-09-30  8:05           ` Fabian Stelzer
2021-09-30 13:56           ` Phillip Wood

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPUEspgr71t-thozi+Ez4xwxAkSJizsLuV=0TnROKZ85M6-kBg@mail.gmail.com' \
    --to=carenas@gmail.com \
    --cc=aidgal2@gmail.com \
    --cc=git@vger.kernel.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).