Treat commits religiously
Every git commit you do is basically a track of the progress of the product. A git commit should basically contain a feature or a bug fix. So commits like "changed a to b", "Removing div element." is not really a progress. Going forward you will need more commits like "ABC class added", "XYZ Function Implemented", etc.
Avoid repeated/duplicate commits
Sometimes, without your knowledge, you would tend to commit a change multiple times. So it is always good to crosscheck the logs using git log before you push.
Test before you push
This is mainly because the changes you made could affect any other feature. So before you commit and push any progress, testing the feature is a must. If the commit may not be right and still you want to push it, you may consider using git stash feature.
Git repo must contain only source files
Sometimes after you test, binary files like "*.class" or CMake build directory will be present and it must be removed before the commit. You should always keep in mind that the repo is only for source not for binaries :)
Commit message
In case of committing multiple features/bugs in a single commit, you can mention the changes in a numbered list like 1) ..... 2) .....
Use git in command line more
By using git in command line, you will get to understand how the version control actually works. GUI makes things easy, but command line makes you understand it.
If you are doing something wrong with git commit so far, no problem. It is never too late, start reflecting the learning from today. And there are tons and tons of best practices available online. I'm sure you will get used to git. If you have any other git commit best practices to share, please do not hesitate to post it in the comment section below.
Comments
Post a Comment