Skip to main content

An official website of the City of Austin.

Application Development

Writing a commit

Our approach to commit authorship Stephen Ball’s Deliberate Git philsoophy. You can watch a video of his presentation of this philosophy from Steel City Ruby 2013.

“Your code can only say what it does right now. You can’t look at a method and see its history: the alternative approaches that have been considered, the algorithms that have already been outgrown, the simpler code that has been replaced, or the complicated code that’s been refactored.Not capturing this knowledge is a huge loss. In Deliberate Git I’ll share how to use Git to write detailed commits that craft a cohesive story about the code without giving up a good programming flow.”

Stephen Ball @ Steel City Ruby 2013

Commit criteria

Good commits answer the following questions, as applicable.

Commit formatting

Examples

Below are commits that follow the Deliberate Git best practices around what and why they were created. They have been replicated here because some are from private repositories which viewers of this file might not have access to.

The format is:

Commit title linking to commit in master branch

Commit message

Commit author & date

Austin Convention Center Website

Work around IE bug impacting inline SVG height

By default, IE 10 and 11 render the interactive floor plan SVGs as only ~150px tall, regardless of their width. Additional CSS declarations don’t seem to have any effect, so I resorted to setting the height manually, via JS, based on the SVG’s viewBox aspect ratio.

Note that the manual height doesn’t update when the window is resized, but I don’t think that’s worth the trouble.

Jacob Paul committed on Jan 2

CitySpace

Improve flexbox implementation

justify-content: space-between makes the last item in a row float to the right when there are fewer items than columns. Thebatch tag in twig allows us to insert missing elements into arrays of a given size. While adding ‘blank’ items could be considered polluting the DOM for the sake of styling, I don’t think it’s terribly offensive.

Had the block implementation been coded to account for the necessary margins between elements differently, we wouldn’t need to insert a spacer element, but it’s important to note that flex box is not a grid system in itself, and this is being used outside of any other grid system.

To change from 3 to 2 or 4 columns across, update lines 57 and 58: cityspace-flexbox-thirds » …-halves or …-fourths and items|batch(3, » items|batch(2 or items|batch(4.

This update also allows for vertical centering of items in tiles.

Tested back to IE10, where blocks line up in a single column as a fallback.

Sources: https://stackoverflow.com/questions/18744164/flex-box-align-last-row-to-grid https://twig.sensiolabs.org/doc/2.x/filters/batch.html

Sarah Rudder committed on May 30