{"id":19364560,"url":"https://github.com/math2001/git-template","last_synced_at":"2026-04-16T14:06:37.198Z","repository":{"id":74806184,"uuid":"77588176","full_name":"math2001/git-template","owner":"math2001","description":"My git template (customised hooks)","archived":false,"fork":false,"pushed_at":"2017-07-31T08:30:15.000Z","size":17,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-06T20:53:04.052Z","etag":null,"topics":["git","hooks","python"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/math2001.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-12-29T06:18:45.000Z","updated_at":"2019-06-25T04:10:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"52fd8111-f7e6-43e7-a04f-c5bb805b2e89","html_url":"https://github.com/math2001/git-template","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/math2001%2Fgit-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/math2001%2Fgit-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/math2001%2Fgit-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/math2001%2Fgit-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/math2001","download_url":"https://codeload.github.com/math2001/git-template/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240483765,"owners_count":19808636,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["git","hooks","python"],"created_at":"2024-11-10T07:37:43.042Z","updated_at":"2026-04-16T14:06:37.152Z","avatar_url":"https://github.com/math2001.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# My git template\n\n\u003c!-- MarkdownTOC --\u003e\n\n- [What is this?](#what-is-this)\n- [Installation](#installation)\n    - [Requirements](#requirements)\n- [Usage](#usage)\n- [Template](#template)\n    - [CSW - Check Stdout Writers](#csw---check-stdout-writers)\n\n\u003c!-- /MarkdownTOC --\u003e\n\n## What is this?\n\nThis repo is a template that I use for my project. Here's what it does:\n\n```commandline\n$ git init\nReinitialized existing Git repository in C:/wamp/www/tests/git-tests/testr/.git/\n$ git populate\n$ ls -R -A\n.:\n.git/  .gitignore  README.md\n\n./.git:\nHEAD  config  description  hooks/  info/  objects/  refs/\n\n./.git/hooks:\napplypatch-msg.sample*  commit-msg.sample*   pre-applypatch.sample*  pre-commit.sample*  pre-rebase.sample*   prepare-commit-msg.sample*  update.sample*\ncommit-msg*             post-update.sample*  pre-commit*             pre-push.sample*    prepare-commit-msg*  py/\n\n./.git/hooks/py:\ncheck-stdout-writers.py*  prepare-commit-msg.py*  validate-commit-message.py*\n\n./.git/info:\nexclude\n\n./.git/objects:\ninfo/  pack/\n\n./.git/objects/info:\n\n./.git/objects/pack:\n\n./.git/refs:\nheads/  tags/\n\n./.git/refs/heads:\n\n./.git/refs/tags:\n```\n\nAs you can see, there is a few hooks, and I have the `populate` command, which if you try, is going to yell at you, saying that there is no such command :laughing:\n\n\n## Installation\n\nDownload this packages wherever you want, say in `~/git-template`\n\n```bash\n# set your template dir (will only affect the content of the .git)\n$ git config --global --set init.templateDir \"~/git-template/content\"\n# set the path to .py who's going to populate your repo content (README, .gitignore)\n$ git config --global init.populater \"~/git-template/content/populatr.py\"\n\n# set the alias 'git populate' to run the populater\n$ git config --global alias.populate \"!python $(git config --get init.populater) $(git config --get init.templateDir)/../root-content\"\n\n```\n\n### Requirements\n\nTo use this package, you need to have Python (I'm using python 3.4) on your system, and the `python` command available in your terminal\n\n## Usage\n\n## Template\n\nIf you want to change the template of the `.git`, change the content of the `content` folder. This is useful if you want to add some hooks for example. This is used when you run `git init`.\n\nOn the opposite side, if you want to edit what's outside of the `.git` folder, edit the content of the `root-content`  folder. This is useful if you want to automatically create a `README.md`, a `.gitignore`. This is used when you run `git populate`.\n\n\u003e !! Watch out! When you run `git populate`, all the content of `root-content` **overwrites** the content of your repository.\n\n### CSW - Check Stdout Writers\n\nThis hook (`.git/hooks/py/check-stdout-writers.py`) checks that you haven't left a `print` in your python files, a `console.log` in your js, etc.\n\n#### Escaping\n\nYou can escape an SW by making sure there is, in the line just above, this: `CSW: ignore`\n\n```js\nif (language == 'js') {\n    language = 'javascript'\n}\n// CSW: ignore\nconsole.log('I dont block your commit')\n\nconsole[log]('me either!')\n\nconsole.log('But I do')\n```\n\nIf you want to escape the entire file, make sure that in the *first* or *second* line, there is this: `CSW: ignore *`\n\n```python\n# CSW: ignore *\n\nprint('not blocking')\n\nprint('me either')\n\nprint('great!')\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmath2001%2Fgit-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmath2001%2Fgit-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmath2001%2Fgit-template/lists"}