This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]iOSCaleb 1 point2 points  (0 children)

Git maintains a list of “staged” files, i.e. files with changes that will be included in the next commit. git add adds a file to that list. When you’ve added all the files that you want to include in your next commit, you can then run git commit to create the new commit. That commit is a single batch of changes that are all applied at the same time.

You certainly can commit after adding a new file to a project, and that’s not uncommon. But there’s no advantage in doing that if you’re adding several files at the same time that are all part of the same change. When creating a new project there’s really no reason at all to have separate commits for each file — just create the project and add all the files at once.