Skip to content

Latest commit

 

History

History
105 lines (65 loc) · 3.65 KB

README.md

File metadata and controls

105 lines (65 loc) · 3.65 KB

TRACK + REPORT ON GIT REPO SIZE (automate via hook)

⚠️ Warning: CODE BLOAT IS A BAD SIGN!!

Table of Contents


Prerequisites:

  1. We have a current version of git locally installed.
  1. We have configured git locally.
$ git config --global user.name "John Appleseed"

$ git config --global user.email "[email protected]"
  1. We have been using git and github to manage online project assets, from media to source code.

  2. We desire expert use of git and githob.

  3. We want to preemptively avoid code project bloat by tracking our git repo sizes.

⚠️ Warning: CODE BLOAT IS A BAD SIGN!!!!

Sample output

Sample Output

Run script from repo root manually after commit

$ bash git-repo-stats.sh

Rerun script from repo root manually after commit

$ echo 'blahblahblahblahblahblahblahblahblahblahblahblah' > new file
$ git status
$ git add .
$ git status
$ git commit -m 'Added some stuff.'
$ git status
$ bash git-repo-stats.sh

Automate Execution As Git Hook

$ echo 'bash git-repo-stats.sh' > .git/hooks/pre-commit; chmod 777 .git/hooks/pre-commit

$ git add .

$ git commit -m 'Added automation via soft link pre-commit hook.'

Suggestions to reduce repo size.

⚠️ Warning: CODE BLOAT IS A BAD SIGN!!

  1. Add a .gitgnore file to omit repo sub-directories which we do NOT want to share.

  2. Learn about testing your code and tracking dependencies.

  3. Use git tree or git submodule.

  4. To reduce .git/ subfolder size: delete it, reset project repo, reinitialize with git, add, commit.

$ rm -rf .git; git init; git add . ; git commit -m 'First commit or reset repo.'

Enhancements

  1. Functionalize this tool and make that functions library a dependency.

  2. Finish team dev dojo I, II, III.

  3. Post about projects on LinkedIn and BigDataProcessing.

  4. Have a suggestion for this project? Please submit a github project issue.

Project Questions Support Group