- Dependencies
- How use hooks
- Style guide
- Making changes to tracked branches
- Setup protectection for repo
- sh
- python 3.6+
git clone [email protected]:pdffiller/styleguide-hooks.git
2. Setup it as your template directory
git config --global init.templatedir $(pwd)/styleguide-hooks
You may ignore the remainder nevertheless it's better to follow the next steps in order to avoid running git init
each time the 'global' hooks are changed or updated.
git config --global core.hooksPath $(pwd)/styleguide-hooks/hooks
Via post-checkout hook you create/recreate the symlink to your hooks directory after every git clone
of git checkout
. Documentation.
TODO: You can add to cron and setup post-update hook.
Each feature, bug fix or any other change must be developed in a separate branch.
Example:
Add
Delete
Change
Fix
Update
Correct
Test
...
The only exception allowed is Initial commit
Reasons:
- Has advantages with automatic code-review
- Makes reading easier
- Reduces the number of characters in the commit message (for example,
Add
versusWas added
orHas been added
) - Matches the format accepted by git itself
When making a commit message, just mentally add a phrase in front of it "When this commit is applied the git will ..."
and your commit message should logically continue this phrase.
Example:
Add new feature
instead of Add new feature.
)
It's git recommendation and soft limit, 50+ characters can be truncated when displayed.
Hard limit - 72 characters.
Used pattern: issue_type / [path_to_folder /] [Jira issue ID /| GitHub issue # /] short_description
short_description
: a short phrase reflecting the essence of the changes, with a separator_
Jira issue ID
: project name and issue number with a hyphenGitHub issue
: short numeric number of a specific issue previously created in this repository
feature
- new functionalityimprove
- improve existing functionalityfix
- various fixes and fixestest
- branch for research, various tests, temporary copy, etc. It is useful, for example, for temporary merging of several branches that are not yet in the master for carrying out integration testing of these branches.docs
- everything related to documentationstyle
- fix typos, fix formattingrefactor
- refactoring application codelegacy
- in some cases, it may take a long time to parallelly develop several development directions in one repository (for example, we have already switched to the v3 module version, but for some terraform configurations, we need changes in the modules of v2 versions, and they will also need an indefinite long time). Such branches are strictly forbidden to be removed from the repository without the permission of the technical support.
Tracked branch is a branch, changes in which are tracked by any build-configuration of Teamcity or another CI process or tool.
Work branch is a branch that has budded off from any one being tracked to make changes to the code, and after that it will be rebased again with the parent branch.
Making any changes to the tracked branches should take place exclusively through pull request.
Otherwise nobody is able to forcast all the consequences of such usage.
Use only stable, tracked branches on GitHub in your applications!
Make sure that the working branch does not conflict with the parent branch.
The corresponding pull request can be merged into the tracked branch only after succesfull review at least one review.
Merge is performed by executing the "rebase and merge" command โ a special button at the bottom of the page โ from the interface of this pull request in GitHub.
Right after the working branch is returned to the church is rebased into the tracked branch - deleted. Branch is to be deleted by the PR assignee who perform the rebase.
Go to repo Settings.
If private repo - enable Vulnerability alerts. In public it enable by default.
Allow only Rebase
WIP check can be found here.
Also, you can enable WIP check protection (or any other) only after create first pull request.
Protection rules can be enforced by enforce_branch_protection.py script.