Publish
- Git course
- Intermediate
- Lesson 73/82
- 5 min
Push the tag to the remote and publish.
Publishing a release
Tags created in your local repository remain on your computer until they are pushed to the remote repository. You can send a release tag to GitHub using the git push origin v3.0.0 command. This makes the same release point available in the remote repository.
git tag -a v3.0.0 -m "Release 3.0.0"
git push origin v3.0.0Pushing tags to a remote repository
To push a single tag, add its name to the git push command. If you want to push multiple local tags together, you can use git push origin --tags. This command transfers local tags to the remote repository; it is not the same operation as pushing a regular branch.
# Single tag
git push origin v3.0.0
# All tags
git push origin --tagsPractice Publish the release tag
Push the v4.0.0 tag to the origin remote repository. Then write the command that pushes all local tags as well. Use two separate lines.
Starter code
# Önce tek sürüm etiketini gönder
# Ardından tüm etiketleri gönderSample solution
git push origin v4.0.0
git push origin --tagsExpected output
v4.0.0 etiketi gönderildi. Tüm etiketler gönderildi.
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 Which command pushes only the v3.0.0 tag to the remote repository?
- git push origin main
- git fetch origin v3.0.0
- git merge v3.0.0
- git push origin v3.0.0 Correct answer
Explanation: The git push origin v3.0.0 command pushes the specified tag to the origin remote.
2 Push all tags
git push origin ____
git push origin --tags
Explanation: The --tags option pushes local tags to the remote repository.
3 Publishing commands
| Term | Meaning |
|---|---|
git push origin v3.0.0 |
Pushes one tag |
git push origin --tags |
Pushes all tags |
origin |
Remote repository alias |
v3.0.0 |
Release tag |