Re: amend warnings with no changes staged
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 6, 2019, 02:47 UTC
- Message-ID
- <xmqqtvavko1h.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20190806021618.GC61803@google.com>
Jonathan Nieder <jrnieder@gmail.com> writes:
Show 26 quoted lines
> Lukas Gross wrote: > >> I had intended to stage commits but forgot to do so. Git responded >> with a normal commit creation message, so I pushed to the remote to >> begin a CI build. When the build failed for the same reason, I >> realized I had forgotten to stage the changes. An additional line in >> the response to the effect of “Warning: did you mean to amend with no >> changes?” would be very helpful to shorten this feedback loop. > > On second thought: > > $ git commit --amend --no-edit > [detached HEAD 33a3db8805] Git 2.23-rc1 > Author: Junio C Hamano <gitster@pobox.com> > Date: Fri Aug 2 13:12:24 2019 -0700 > 2 files changed, 2 insertions(+), 1 deletion(-) > $ > > Some non-judgemental descriptive output like > > $ git commit --amend --no-edit > No changes. > $ > > would address this case, without bothering people who are doing it > intentionally. So I think there's room for a simple improvement here.
I do that to refresh the committer timestamp. Do I now have to say something silly like
$ GIT_EDITOR=true git commit --amend
to defeat the above (mis)feature, or is there a cleaner workaround?
Obviously I'd prefer to see a solution that does not force existing users to work around the new behaviour ;-)
> Care to take a stab at it? builtin/commit.c would be the place to > start.
I'd suggest not to start it before we know what we want. I am not yet convinced that "--amend --no-edit will become a no-op" is the final solution we want.