Be conscious about what to commit to source control
All commits to source code should be approached with caution. Some techniques that could be helpful are:
git add *.h *.cpp
That command only added header and cpp files - as opposed to doing git add *.
It’s important to avoid committing intermediate files to source control.
Another helpful technique is to do things like git commit and look carefully at the files you are committing. Then doing git diff <fileName> on each one is a good way to check what you have changed - generally speaking this is a big way to avoid accidentally checking in mistakes that you didn’t intend to commit to source control. Think of it as operating on a patient - you want to be careful that tools haven’t been accidentally left in the patient before we sew them up.
Avoid doing big commits last thing in day just before going home. Doing commits last thing before we leave might result in a build breakage which could interrupt work for the rest of the team - if there is a reasonable risk a code commit could break the build in that way it’s probably best practice to ask another team member to walk through and explain the code out before committing and have them run it on their machine before you leave so there is time to fix problems or roll back changes.