Git is easy to get along with if you follow a few simple rules of thumb. Things can still go wrong, but they do so, it’s less often and when it does, it’ll usually less of a problem to fix!
- NEVER work directly on the master branch (this should be the latest working version of your project).
- Commit files often and when it makes sense. Don’t leave it until there are multiple random things that need committing as if one breaks the site, then you might have to revert all of them.
- Branch for each feature and fix and always branch off master (except in very few circumstances).
- Make sure commit messages are simple to understand. If it’s something you need to explain then do a Git commit (without the -m) and a text editor should load where you can explain yourself on multiple lines (similar to markdown).
- Always merge master into your branch and fix conflicts before merging your branch into master. This means conflicts won’t break master.
- Ignore secret files (configs), package managed files and compiled files for security, bloat and reduced conflicts.