Using Git efficiently
Version control is one of the most important tools in the software development lifecycle (SDLC). We will not go into the basics of Git in this chapter, but rather we will discuss the good practices one should follow while using Git. Let us look into a few good practices that are recommended while using Git:
- Always create a new branch event for small changes. A lot of times, developers get tempted to directly commit their changes to
main
,master
,develop
, or any other name used for the default branch, depending upon what they are using. - Add a
.gitignore
file as soon as you create a project. - Never allow anyone to have access to push code to the default branch. Every piece of code should be merged to the default branch using a pull request (PR).
- Always make sure Git is configured locally and has the developer’s name, email, and other relevant details.
- Use the
git merge
command strategy while merging two branches and avoid using rebase...