git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Rast <trast@student.ethz.ch>
To: George Spelvin <linux@horizon.com>
Cc: <git@vger.kernel.org>
Subject: Re: Git feature request: --amend older commit
Date: Fri, 17 Aug 2012 18:37:13 +0200	[thread overview]
Message-ID: <87628heapy.fsf@thomas.inf.ethz.ch> (raw)
In-Reply-To: <20120817154749.11762.qmail@science.horizon.com> (George Spelvin's message of "17 Aug 2012 11:47:49 -0400")

"George Spelvin" <linux@horizon.com> writes:

> With git's "commit frequently" style, I often find that I end up with a
> commit that includes a typo in a comment or I forgot one call site when
> updating functions or something.
[...]
> But it would be really handy if there were a one-step command for doing this.
>
> Something like "git commit --fixup HEAD~3", where "git commit --fixup HEAD"
> would be equivalent to "git commit --amend".

Umm, --fixup is already taken and makes the subject be 'fixup! <subject
of argument>'.  This can then be used by rebase -i --autosquash (or
rebase.autosquash=true) to automatically put the fixup(s) that have
accumulated into the right places.  In addition, git-rebase learned to
automatically use the upstream as the default base.

So for me it's usually a matter of

  git add -p
  git commit --fixup=...
  # repeat the above two until all fixups are lined up
  git rebase -i
  # close editor without making changes

Is that still too much effort?


<plug mode=shameless>

The ideas discussed in
  http://thread.gmane.org/gmane.comp.version-control.git/202535/focus=202569
also help selecting the fixup argument more quickly.

</plug>

-- 
Thomas Rast
trast@{inf,student}.ethz.ch

  parent reply	other threads:[~2012-08-17 16:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-17 15:47 Git feature request: --amend older commit George Spelvin
2012-08-17 16:33 ` Michael Haggerty
2012-08-17 17:00   ` George Spelvin
2012-08-17 16:37 ` Thomas Rast [this message]
2012-08-18  1:41 ` Jared Hance
2012-08-18 21:57   ` Junio C Hamano

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=87628heapy.fsf@thomas.inf.ethz.ch \
    --to=trast@student.ethz.ch \
    --cc=git@vger.kernel.org \
    --cc=linux@horizon.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;
as well as URLs for NNTP newsgroup(s).