On Tue, Aug 06, 2019 at 12:11:53PM -0700, Junio C Hamano wrote: > Jeff King <peff@xxxxxxxx> writes: > > > git commit -m 'buggy commit' > > echo fix >>file.c > > git commit --amend ;# oops, should have been "-a" > > git push > > > > But perhaps that gets to the heart of the matter. Could we perhaps be > > providing a more detailed summary of what happened for an --amend? I.e., > > to summarize _both_ sets of changes (and if one set is empty, say so)? > > ... > > judgement about whether it's an error, since it may well be that you > > were simply rewording the commit message). > > Perhaps "git range-diff HEAD@{1}...HEAD" being an empty is a sign > that either the user intentionally or accidentally did not do > anything other than "touch"ing the commit. > > "git commit --amend --[no-]range-diff" that shows what you changed > with the amending may be an interesting possibility; I am not yet > ready to seriously encourage anybody to explore it, though, because > "git diff HEAD@{1}" is much easier to see what code got changed, but > one (and probably only) downside is that it does not cover the > change in the log message. I hadn't even thought of range-diff. Showing the commit message diff would be a big improvement. A range-diff would also show an update to the author (e.g., if you used --reset-author). We don't really need the full power of range diff, though. After all, we know there are exactly two patches to compare, so we don't care about it trying to figure out which ones correlate (and it might even be a bad thing for it to decide that two entries don't match). So I think we'd probably want our own custom thing. -Peff