# Git Recommendations The following are a collection of suggestions to best use Git as a source control system. - Commits SHOULD represent a logical unit of work. - Commit frequently - Push your commits to a branch on your own fork, if possible. - Write [descriptive commit messages]. - Keep remote repository up-to-date by committing and pushing your work regularly. - Keep your local copies of repositories up-to-date by regularly pulling changes. - Frequently pull from upstream to the `main` branch, and rebase your changes on top (see the [rebase workflow]). - Coordinate with colleagues to avoid nasty merge conflicts (if you can). - Try the git [rebase workflow]. - Use branches and merge requests. - Pick a branching strategy that works for you and your team. Consider [GitHub Flow](https://guides.github.com/introduction/flow/index.html). - Create a new branch for each feature or bugfix. - The `main` branch SHOULD always contain releasable code. - Protect your `main` branch; require merge requests to make changes. - Configure a group of default reviewers for your pull requests. - For teams of 4 or more, require a minimum of 2 approvers for all merge requests. - Avoid force operations (`-f` or `--force` option), especially on `main` branch, as this is an indication you are probably doing something wrong. - Keep your repository neat: always delete merged branches. [descriptive commit messages]: https://cbea.ms/git-commit/#seven-rules [rebase workflow]: https://git-rebase.io