Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
12,047 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.