Development Tools Introduction to Git First Commits Viewing Changes to a File

Best practices for committing changes

Given the limited amount of characters we have to describe the commit message it makes sense to me to commit one file at a time so we can return a more detailed and accurate history of changes when using the git log --oneline command.

On the flip side, this adds a lot more commit messages to skim through and can clutter the commit history.

What is considered a best practice for committing changes?

1 Answer

Indiya Gooch
Indiya Gooch
11,700 Points

This can be dependant on a multitude of factors, including workplace guidelines (if any) and personal preference, and the way used to commit - for example using a command line (terminal on mac) or github Desktop.

With github Desktop the current interface allows you to have a 'title' and 'description' for your commit,meaning you can have a memorable 'title' that will appear for the --oneline command, but a 'description' also that you can access separately via github, or the desktop interface, so that if needed you can document what changes have been made in length to each file without cluttering the commit history.