Release commit
- Git course
- Intermediate
- Lesson 72/82
- 5 min
Create the release commit and merge the branch.
What is a release commit?
A release commit records changes made during release preparation in Git history. It may include the CHANGELOG update and other release-related files. It is usually created on a preparation branch and then merged into the main branch.
git add CHANGELOG.md
git commit -m "chore: prepare release 2.0.0"
git switch main
git merge releaseMerge the release branch into the main branch
When release preparation is completed on a separate branch, you can transfer the changes to the main branch. First, switch to the main branch with git switch main. Then, git merge release merges the commits from the preparation branch into the main branch.
git switch main
git merge releasePractice Create and merge the release commit
First stage the CHANGELOG.md file. Then create a commit with the message chore: release 3.0.0. Finally, switch to the main branch and merge the release branch.
Starter code
# CHANGELOG dosyasını sahnele
# Release commit oluştur
# Ana dala geç
# Release dalını birleştirSample solution
git add CHANGELOG.md
git commit -m "chore: release 3.0.0"
git switch main
git merge releaseExpected output
Dosya sahnelendi. Release commit oluşturuldu. Ana dala geçildi. Release dalı birleştirildi.
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 At which stage is a release commit usually created?
- When release preparation is completed Correct answer
- When the repository is first cloned
- When the remote repository is deleted
- When Git configuration is removed
Explanation: After release files and notes are prepared, they are recorded in a commit.
2 Merge the release branch
git switch main
git merge ____
git switch main
git merge release
Explanation: After switching to the main branch, the name of the branch to merge is passed to git merge.
3 Release commit workflow
| Term | Meaning |
|---|---|
release dalı |
Release preparation branch |
git commit |
Creates the release record |
git switch main |
Switches to the main branch |
git merge release |
Merges the preparation branch |