Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Introduction to Git First Commits Staging Changed Files

Michael Steinman
Michael Steinman
11,012 Points

Why not add the medals directory?

Why would we add every file in the medals directory, when we could just add the entire directory?

1 Answer

Alex Koumparos
seal-mask
.a{fill-rule:evenodd;}techdegree
Alex Koumparos
Python Development Techdegree Student 36,887 Points

Hi Michael,

You absolutely could just add the medals directory rather than the individual files. If you're absolutely certain that all the changes in that directory relate to the work you are describing in your commit message, then this is probably the most appropriate approach.

However, when we are working on real projects, it's very common to be modifying a file for one reason, and then seeing something in that file triggers us to want to change something in another file for an unrelated reason (e.g., we're making some changes to the foo algorithm and we see something that reminds us of a change we had been intending to make in bar.py). We now have changes to multiple files as part of different activities.

When we come to commit our changes and we're thinking, "I'm going to commit the work I did on the foo algorithm", we don't want to accidentally muddy our commit with files that have unrelated changes. Manually adding the individual files we know we changed as part of the activity described in the commit message is one way to ensure that our commits are tidy and only relate to one area of work.

Hope that clears things up.

Cheers

Alex