Using Git as a Communication Tool

Using Git as a Communication Tool

As Josh Freeman of Grok Interactive shared with our students during a lunchtime talk, it’s extremely important to maintain quality communication when working on a project.

Git, while primarily a tool for version control, can be used to facilitate this kind of interaction. Freeman recommends two simple steps to maximize communication in Git.

1. Use the Git commit as an opportunity to increase communication by explaining the changes you make to your code, as opposed to explaining it in a comment.

Set up a Git commit template, or a standardized layout for commit messages. Freeman’s template is listed below. Don’t forget, your commit message summary must be 50 characters or less; all other lines should be under 72 characters.

(Configuring your Git commit template)

Example Git Commit Template:

2. Organize your commits logically.

Sections of code that don’t relate to each other shouldn’t be committed together. Instead, break your code into logical sections and commit each section separately.

You can accomplish this by adding to the index in patches, which allows you to stage parts of files and provides finer control over what you commit. Maintaining an organization to your commits will make it much easier to communicate via the commit template.

(Adding to the index in patches)

Following these two simple Git guidelines can prevent frustration that arises when deciphering code. Communication is key not only for your current team members, but also for your future self or future developers who may inherit your code sometime down the line.