The Ten Git-mmandments
Jump to navigation
Jump to search
Herein lies precious Git-related wisdom, do not disregard at your own risk!
- Do NOT treat Git repositories like Google Drive.
- Git repositories do not exist to for you to backup all your files (e.g., cache, output and log files).
- Do not be trigger happy with ```git add --all```.
- In other words, do not add whole directories.
- Maintain a minimalistic mentality, i.e., carefully consider what files are important with the focus on successfully allowing the user to run your code.
- Do NOT include .pyc files, the entire __pycache__ folder and .DS_Store files.
- Basically, you have been warned.
- Do NOT ignore .gitignore.
- They do not exist for no reason, create one to satisfy the above rules.
- Visit https://git-scm.com/docs/gitignore for more information on formatting one.
- Do not skip the following example:
- > Sometimes, you might want to code using an IDE on your personal computer, git push and then git pull onto a workstation to run the code.
- > As expected, you run into an error, nano into the file with the error and make the necessary changes.
- > The code now works and you happily git push from the workstation, with all your output and cached folders.
- Do NOT send a merge request with over 453 changed files - this is impossible to review!
- Do not operate with the mentality of only submitting completed working code.
- Do not forget that little and often with code review is better than the former.
- Besides the mundane rationale of catching your mistakes and getting feedback quicker rather than letting than accumulate, it allows the reviewer to better track and follow your changes.
- Do NOT foster a habit
"Do not" counter: 12+