Commit 39d07d98 authored by George Adrian Stoica's avatar George Adrian Stoica
Browse files

docs: update slides for lecture 15

parent 9ce16c45
Pipeline #142924 passed with stages
in 1 minute and 52 seconds
......@@ -23,9 +23,6 @@ IT1901 Fall 2021 - {LECTURE_NO}
[color = "#fff6d5"]
== Planning development tasks
== Planning development tasks
- workflow and conventions
- prevent conflicts and complicated merges
- run checks before sharing changes
......@@ -33,13 +30,14 @@ IT1901 Fall 2021 - {LECTURE_NO}
== Workflow and conventions
agree on workflow and conventions the team is using, have that documented and available in your repository
- branching strategies
- branch naming
- commit message format
- issue templates
- MR templates
- use of labels and boards in gitlab
- agree on workflow and conventions the team is using
- have that documented and available in your repository
** branching strategies
** branch naming
** commit message format
** issue templates
** MR templates
** use of labels and boards in gitlab
== Prevent conflicts and complicated merges
......@@ -51,6 +49,7 @@ agree on workflow and conventions the team is using, have that documented and av
== Test and check before sharing changes
before pushing (especially to long lived branches like main/master)
- make sure everything builds and runs
- verify that the code passes all tests and quality checks
......@@ -58,9 +57,6 @@ before pushing (especially to long lived branches like main/master)
[color = "#fff6d5"]
== Committing strategies and best practices
== Committing strategies and best practices
- small commits dealing with a single topic
- stage just the changes that are relevant
- you can stage just part of the changes to a file to include in a commit
......@@ -86,6 +82,7 @@ before pushing (especially to long lived branches like main/master)
== Staging file parts options (2)
[.smaller-80]
- *j* leave this hunk undecided, see next undecided hunk
- *J* leave this hunk undecided, see next hunk
- *k* leave this hunk undecided, see previous undecided hunk
......@@ -153,8 +150,9 @@ https://xkcd.com/1296/
- more types: build, chore, ci, docs, style, refactor, perf, test
- footers other than BREAKING CHANGE: `<description>` may be provided and follow a convention similar to git trailer format (`token: value`).
== Why to use the conventional commits:
== Why to use the conventional commits?
[.smaller-80]
- Automatically generating CHANGELOGs.
- Automatically determining a semantic version bump (based on the types of commits landed).
- Communicating the nature of changes to teammates, the public, and other stakeholders.
......@@ -164,6 +162,7 @@ https://xkcd.com/1296/
== What to write in the commit message
[.smaller-80]
- the subject line is the most important
- clearly state the original issue / problem
- clearly state *why* the change is made
......@@ -178,6 +177,16 @@ Finally, read the message before committing as it might reveal that you should s
- use tools such as commitlint and commitizen to check the messages
- use git hooks check the message format
== Install Commitizen
- `npm install -g commitizen`
- `npm install -g cz-conventional-changelog`
- `echo '{ "path": "cz-conventional-changelog" }' > ~/.czrc`
== Install Commitlint
- `npm install -g @commitlint/cli @commitlint/config-conventional`
- `echo "module.exports = {extends: ['@commitlint/config-conventional']}" > ~/commitlint.config.js`
== Commit hooks
......@@ -185,9 +194,38 @@ Finally, read the message before committing as it might reveal that you should s
- can be global (all repositories) or local (the repo they are in)
- can be used to enforce commit message format
== git hook example
```bash
#!/bin/bash
echo "Checking commit message: "
# run any local commit-msg hook first
if test -f ./.git/hooks/commit-msg; then
echo "Running local git hook first."
sh ./.git/hooks/commit-msg
else
echo "Local hook does not exist."
fi
commitlint < $1
exit $status
```
[background-color = "#124990"]
[color = "#fff6d5"]
== Demo
== References
- https://eidson.info/post/using-conventional-commit-messages-globally
- https://wiki.openstack.org/wiki/GitCommitMessages
include::{includedir}footer.adoc[]
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment