Why do we need it?
when we start writing a code for some application it is quite evident that numerous function/comments/declarations yada yada... are added or removed. It keeps happenining back and forth. Sometimes the previous logic was right and probably dont remeber what exactly was written...and obvious Ctrl+Z helps a lot for the beginners. But in the big pitucre with larger team, working on same project ain't easy at all with the methods like this.
Thats where the logic of Version control comes..Write certain things comit it. write again and commit it. Each comit is maitined unqiqely. Hence it is possible to
a. revert any previous commit and work on with hustle
b. code reviewers can review your code and help to rectify quite easly.
c. minimizing disruption to all team members
d. convinent to fix bugs
e. smooth and continuous flow of changes to the code
f. accelerates the developer's working
Best practices to achieve above benfits follow these basic calls
- Always Git pull. Make sure to work on lates source code.
- Always commit. Irrespective of what modification/addition is done
- Explain Commit. each commit should be explained WHAT was done and WHY.
- Always Review before commiting
- Follow a branch pattern. This saves a lot of time. Commit in branch do whatever code flow needed, do testing, review and finaly merge into master branch. This will be least disruptive overall.