Good advice here, but I would just say we should mention that git --amend is still recommended if you committed something and then realized there was a mistake.
- Using it to fix a typo or minor error in a commit = awesome. - Using it to pile up tons of changes across tons of files = not awesome.
The former makes review EASIER, the latter makes review HARDER.
- Trevor
On Mon, Mar 26, 2012 at 11:24 PM, Amir E. Aharoni < amir.aharoni@mail.huji.ac.il> wrote:
2012/3/27 Tim Starling tstarling@wikimedia.org:
For commits with lots of files, Gerrit's diff interface is too broken to be useful. It does not provide a compact overview of the change which is essential for effective review.
Luckily, there are alternatives, specifically local git clients and gitweb. However, these don't work when git's change model is broken by the use of git commit --amend.
For commits with a small number of files, such changes are reviewable by the use of the "patch history" table in the diff views. But when there are a large number of files, it becomes difficult to find the files which have changed, and if there are a lot of changed files, to produce a compact combined diff.
So if there are no objections, I'm going to change [[Git/Workflow]] to restrict the recommended applications of "git commit --amend", and to recommend plain "git commit" as an alternative. A plain commit seems to work just fine. It gives you a separate commit to analyse with Gerrit, gitweb and client-side tools, and it provides a link to the original change in the "dependencies" section of the change page.
It sounds similar to what i said in the thread "consecutive commits in Gerrit", so i probably support it, but i don't completely understand how will it work with the `git review' command, which doesn't like multiple commits. If the documentation will explain how to use `git review' with follow up commits, it will be fine.
-- Amir Elisha Aharoni · אָמִיר אֱלִישָׁע אַהֲרוֹנִי http://aharoni.wordpress.com “We're living in pieces, I want to live in peace.” – T. Moore
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l