Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
course-material
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IT1901
course-material
Commits
39d07d98
Commit
39d07d98
authored
3 years ago
by
George Adrian Stoica
Browse files
Options
Downloads
Patches
Plain Diff
docs: update slides for lecture 15
parent
9ce16c45
No related branches found
No related tags found
No related merge requests found
Pipeline
#142924
passed
3 years ago
Stage: build
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lectures/revealjs/15-lecture-commit.adoc
+52
-14
52 additions, 14 deletions
lectures/revealjs/15-lecture-commit.adoc
with
52 additions
and
14 deletions
lectures/revealjs/15-lecture-commit.adoc
+
52
−
14
View file @
39d07d98
...
@@ -23,9 +23,6 @@ IT1901 Fall 2021 - {LECTURE_NO}
...
@@ -23,9 +23,6 @@ IT1901 Fall 2021 - {LECTURE_NO}
[color = "#fff6d5"]
[color = "#fff6d5"]
== Planning development tasks
== Planning development tasks
== Planning development tasks
- workflow and conventions
- workflow and conventions
- prevent conflicts and complicated merges
- prevent conflicts and complicated merges
- run checks before sharing changes
- run checks before sharing changes
...
@@ -33,13 +30,14 @@ IT1901 Fall 2021 - {LECTURE_NO}
...
@@ -33,13 +30,14 @@ IT1901 Fall 2021 - {LECTURE_NO}
== Workflow and conventions
== Workflow and conventions
agree on workflow and conventions the team is using, have that documented and available in your repository
- agree on workflow and conventions the team is using
- branching strategies
- have that documented and available in your repository
- branch naming
** branching strategies
- commit message format
** branch naming
- issue templates
** commit message format
- MR templates
** issue templates
- use of labels and boards in gitlab
** MR templates
** use of labels and boards in gitlab
== Prevent conflicts and complicated merges
== Prevent conflicts and complicated merges
...
@@ -51,6 +49,7 @@ agree on workflow and conventions the team is using, have that documented and av
...
@@ -51,6 +49,7 @@ agree on workflow and conventions the team is using, have that documented and av
== Test and check before sharing changes
== Test and check before sharing changes
before pushing (especially to long lived branches like main/master)
before pushing (especially to long lived branches like main/master)
- make sure everything builds and runs
- make sure everything builds and runs
- verify that the code passes all tests and quality checks
- verify that the code passes all tests and quality checks
...
@@ -58,9 +57,6 @@ before pushing (especially to long lived branches like main/master)
...
@@ -58,9 +57,6 @@ before pushing (especially to long lived branches like main/master)
[color = "#fff6d5"]
[color = "#fff6d5"]
== Committing strategies and best practices
== Committing strategies and best practices
== Committing strategies and best practices
- small commits dealing with a single topic
- small commits dealing with a single topic
- stage just the changes that are relevant
- stage just the changes that are relevant
- you can stage just part of the changes to a file to include in a commit
- 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)
...
@@ -86,6 +82,7 @@ before pushing (especially to long lived branches like main/master)
== Staging file parts options (2)
== Staging file parts options (2)
[.smaller-80]
- *j* leave this hunk undecided, see next undecided hunk
- *j* leave this hunk undecided, see next undecided hunk
- *J* leave this hunk undecided, see next hunk
- *J* leave this hunk undecided, see next hunk
- *k* leave this hunk undecided, see previous undecided hunk
- *k* leave this hunk undecided, see previous undecided hunk
...
@@ -153,8 +150,9 @@ https://xkcd.com/1296/
...
@@ -153,8 +150,9 @@ https://xkcd.com/1296/
- more types: build, chore, ci, docs, style, refactor, perf, test
- 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`).
- 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 generating CHANGELOGs.
- Automatically determining a semantic version bump (based on the types of commits landed).
- 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.
- Communicating the nature of changes to teammates, the public, and other stakeholders.
...
@@ -164,6 +162,7 @@ https://xkcd.com/1296/
...
@@ -164,6 +162,7 @@ https://xkcd.com/1296/
== What to write in the commit message
== What to write in the commit message
[.smaller-80]
- the subject line is the most important
- the subject line is the most important
- clearly state the original issue / problem
- clearly state the original issue / problem
- clearly state *why* the change is made
- 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
...
@@ -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 tools such as commitlint and commitizen to check the messages
- use git hooks check the message format
- 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
== Commit hooks
...
@@ -185,9 +194,38 @@ Finally, read the message before committing as it might reveal that you should s
...
@@ -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 global (all repositories) or local (the repo they are in)
- can be used to enforce commit message format
- 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"]
[background-color = "#124990"]
[color = "#fff6d5"]
[color = "#fff6d5"]
== Demo
== Demo
== References
- https://eidson.info/post/using-conventional-commit-messages-globally
- https://wiki.openstack.org/wiki/GitCommitMessages
include::{includedir}footer.adoc[]
include::{includedir}footer.adoc[]
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment