Andy J Andy J - 1 year ago 83
Git Question

Is it appropriate to keep adding before a commit?

I'm still new to git and I'm reading a lot in the docs trying to figure out the practicals. When want to store my files onto the server , I go like this.

git add .
git commit --message "Poof goes the dynamite"
git push repo stuff

I called my remote repo instead of origin and stuff is my branch (like dev or development).

It works. But I wonder if this is the appropriate approach or if I'm missing the correct way to use git. It seems so mundane and repetitive to keep adding the files over and over again. It feels like if saving a modified file should already trigger the version control mechanism to mark its status as commitable.

Answer Source

Yes, this is the correct workflow. Oftentimes, when working with large projects, you end up touching a large number of files, but may want to separate them out into different commits.

Ideally, each commit should represent one logical change, so blanket-adding everything may not be what you want.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download