All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konstantin Kharlamov <hi-angel@yandex.ru>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: How to interactively rebase-and-reword nth commit?
Date: Fri, 27 Aug 2021 12:18:00 +0300	[thread overview]
Message-ID: <826fa09ce470d1a3f06714cdd7f75891fecda676.camel@yandex.ru> (raw)
In-Reply-To: <YShISkyN7stYtkV2@coredump.intra.peff.net>

On Thu, 2021-08-26 at 22:04 -0400, Jeff King wrote:
> On Wed, Aug 25, 2021 at 05:06:03PM +0300, Konstantin Kharlamov wrote:
> 
> > Any ideas, how can I tell `git` that I want to "reword" nth commit right
> > away? Sure,
> > I am not the first one to stumble upon it, am I? Any ideas?
> 
> Have you looked at the new --fixup options in 2.32? E.g.:
> 
>   git commit --fixup reword:HEAD~2
> 
> will immediately drop you in an editor to adjust the commit message. The
> result is a new "fixup" commit which is then applied when you
> autosquash. So you could do multiple such adjustments, and then:
> 
>   GIT_EDITOR=: git rebase -i --autosquash
> 
> to apply them all to the appropriate spots.
> 
> -Peff

Thank you for the suggestion! I think I gonna stick to the `rebase-at` now that I know the way to solve my problem with GIT_SEQUENCE_EDITOR. The "rebase-at" workflow sounds better optimized to me, due to lack of the `git rebase -i --autosquash` step.

I get that the idea with autosquash that you can remove the commit if you realize you did something wrong. But I usually have a copy of the local branch on a remote repo, so in rare cases I realize I want to undo the change I can simply run `git reset --hard origin/mybranch` ☺ (otherwise, reflog is also a thing).


      reply	other threads:[~2021-08-27  9:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-25 14:06 How to interactively rebase-and-reword nth commit? Konstantin Kharlamov
2021-08-25 15:01 ` Ævar Arnfjörð Bjarmason
2021-08-25 15:54 ` Martin Ågren
2021-08-25 16:32   ` Konstantin Kharlamov
2021-08-26  6:28 ` ZheNing Hu
2021-08-27  2:04 ` Jeff King
2021-08-27  9:18   ` Konstantin Kharlamov [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=826fa09ce470d1a3f06714cdd7f75891fecda676.camel@yandex.ru \
    --to=hi-angel@yandex.ru \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.