Skip to content

Instantly share code, notes, and snippets.

@kenielf
Created July 20, 2023 12:08
Show Gist options
  • Save kenielf/ca74d6f086437806e9fa3256f754de0e to your computer and use it in GitHub Desktop.
Save kenielf/ca74d6f086437806e9fa3256f754de0e to your computer and use it in GitHub Desktop.

Personal Git Organization

Preamble

This is meant as a memo and guide for the usage of my own git structure, and I do not intend for this to be the "most optimal" way possible, just simply a way I found to organize and structure my repositories.

Others are more than welcome to copy, change and critique in whichever way they might prefer.

Things written in this gist are likely to change according to my own preference in the future, so if anything here is in any way meaningful to you, please fork it or make a copy in a place you can find it!

Commits

  • Commits must be signed whenever possible.
  • Use clear and concise language to describe changes.

Structure

[TYPE] SECTION: DESCRIPTION

  • TYPE: The kind of action the commit is meant to convey, and formatted to be entirely capitalized, currently the scheme I use is the following:
    • INIT: For brand new repositores, commits of this type include a bunch of boilerplate and generic stuff to prepare for a project.
    • CODE: For additions and modifications of snippets of code.
    • REMOVAL: For the removal of snippets of code.
    • DEPRECATION: For changes in snippets of code that will likely be removed in the future.
    • BUGFIX: For changes in snippets of code meant to fix a certain issue.
    • VULN: For emergency fixes to deal with software vulnerabilities.
  • SECTION: Where the changes or additions happened and where it impacts.
  • DESCRIPTION: A short commentary about what was changed or added.

Note: commit message bodies may be used for more concise explanations of changes, and its use is encouraged.

Example

  1. Creating a brand new repository:

    mkdir -p ~/Projects/CoolProject && cd ~/Projects/CoolProject
    git init --initial-branch="main"
    echo "# Cool Project" > README.md
    git add README.md
    git commit -S -m "[INIT] Cool Project - Initializing project repo."
  2. Adding a feature to a specific project

    git add src/cryptography/newmethod.py
    git commit -S -m "[CODE] Cryptography - Added a new method of encryption."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment