Annotations to the discussed page:
-
autogenerate documentation: https://gitversion.net/docs/
-
Arlo’s Commit Notation: https://github.com/RefactoringCombos/ArlosCommitNotation
-
Find a bug in between two commits: https://git-scm.com/docs/git-bisect
-
Why 72 chars as commit message description? -> Terminal size: as a lot of people use terminals 80 characters wide, and commit messages are often shown with 4 spaces indentation (add another 4 for the same margin on the right side), 72 is an ideal length.
Unspecified link collection:
- Recommended book (German): https://www.amazon.de/Git-Dezentrale-Versionsverwaltung-Grundlagen-Workflows/dp/3898648001
- Git branching model Github Flow: https://docs.github.com/en/get-started/using-github/github-flow
- Imperative Mood, for commit messages: https://en.wikipedia.org/wiki/Imperative_mood
- Git Butler, Git Tool: https://gitbutler.com/
- fork.dev, Git Tool: https://fork.dev/
- Gitkraken, Git Tool: https://www.gitkraken.com/
Comment:
- "If it's not pushed, it doesn't exist."
-
Adhere to Conventional Commits (whenever possible)
-
Imperative Mood
-
Refer to Jira Ticket (Use Smart Commits!)
-
Short (<72 chars) Summary
-
More detailed explanatory text after line break
Short (72 chars or less) summary
More detailed explanatory text. Wrap it to 72 characters. The blank line separating the summary from the body is critical (unless you omit the body entirely).
Write your commit message in the imperative: "Fix bug" and not "Fixed bug" or "Fixes bug." This convention matches up with commit messages generated by commands like git merge and git revert.
Further paragraphs come after blank lines.
- Bullet points are okay, too.
- Typically a hyphen or asterisk is used for the bullet, followed by a single space. Use a hanging indent.
feat(ABC-123): Add CPU arch filter scheduler support
In a mixed environment of…
If applied, this commit will
-
Separate subject from body with a blank line
-
Do not end the subject line with a period
-
Capitalize the subject line and each paragraph (adhering to Conventional Commits)
-
Use the imperative mood in the subject line
-
Wrap lines at 72 characters
-
Use the body to explain what and why you have done something. In most cases, you can leave out details about how a change has been made.
-
Describe why a change is being made.
-
How does it address the issue?
-
What effects does the patch have?
-
Do not assume the reviewer understands what the original problem was.
-
Do not assume the code is self-evident/self-documenting.
-
Read the commit message to see if it hints at improved code structure.
-
The first commit line is the most important.
-
Describe any limitations of the current code.
-
Do not include patch set-specific comments.
If the commit refers to an issue, add this information to the commit message header or body.
In header:
fix(ABC-123): Refer to GitHub issue…
In body:
… Fixes ABC-123, ABC-124
-
develop
always contains buildable code -
main
(old:master
) contains every main-line release -
Code reaches
develop
&main
only through Pull Requests -
Branch names follow the schema
feature/ABC-123-short-ticket-description
-
For releases use
release/MAJOR.MINOR.PATCH
, for hotfixes usehotfix/MAJOR.MINOR.PATCH
-
Custom releases use a different prefix,
custom-prefix/feature/ABC-123-short-ticket-description
, etc. We try to avoid custom releases! -
Always create a (Jira) ticket and refer to it! (“No ticket, no work!”)
At the time of writing we currently use Git Flow. For a detailed explanation read the reference. This might change in the future with improved CI/CD.
Typically a repo has at least two branches:
-
main
(new/encouraged naming) ormaster
(old/discouraged naming): Each commit onto this branch represents a main-line release. Jumping between commits on this branch represents jumping between publicly released versions. -
develop
: Each commit onto this branch represents a piece of work (== feature) being worked on and finished at the time of the commit. Jumping between commits on this branch represents jumping between functionally complete versions with a potentially different feature set.
When working on a new feature, a developer checks out develop
, branches off from there to feature/ABC-123-short-description
, and ends up (squash) committing back to develop
using a Pull Request.
-
Use
git rebase
for a linear history -
Descriptive PR Name with corresponding ticket [ABC-123]
-
Open PR asap & mark with “[WIP]”
-
Describe your PR! Bad: No Description. Better: Too much detail.
-
Delete old
feature/
-branches after merging -
Keep
release/
-branches
We use git rebase
to keep our merge history linear, clean and easy-to read. When you are done with your work on your feature branch and your main branch is up-to-date:
git rebase main git push --force-with-lease
This also allows you to have merge
commits in the history of your branch (e.g. from previously merging main
into your feature/
branch).
-
https://www.atlassian.com/blog/git/written-unwritten-guide-pull-requests
-
https://opensource.creativecommons.org/contributing-code/pr-guidelines/
- Be nice when reviewing other people’s code - challenge the idea, not the person
WIP