Git rules of thumb

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!

  1. NEVER work directly on the master branch (this should be the latest working version of your project).
  2. 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.
  3. Branch for each feature and fix and always branch off master (except in very few circumstances).
  4. 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).
  5. Always merge master into your branch and fix conflicts before merging your branch into master. This means conflicts won’t break  master.
  6. Ignore secret files (configs), package managed files and compiled files for security, bloat and reduced conflicts.
Published on


comments powered by Disqus