The Ten Git-mmandments: Difference between revisions

From Thom Group Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
Herein lies precious Git-related wisdom, disregard at your own risk!
Herein lies precious Git-related wisdom, do not disregard at your own risk!


# '''Do NOT treat Git repositories like Google Drive'''.
#'''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+

Revision as of 13:11, 25 August 2022

Herein lies precious Git-related wisdom, do not disregard at your own risk!

  1. 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.
  2. Do NOT include .pyc files, the entire __pycache__ folder and .DS_Store files.
    • Basically, you have been warned.
  3. 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.
  4. 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.
  5. Do NOT foster a habit



"Do not" counter: 12+