Pushing tags
- Git course
- Intermediate
- Lesson 23/82
- 4 min
Learn to push tags to the remote repository.
Tags Are Not Pushed Automatically
When you push a commit to a remote repository, its tags are not necessarily pushed automatically. You may need to publish release tags separately.
git push origin v1.0.0This command pushes only the specified tag to the origin remote.
Pushing All Tags
You can use git push --tags to push all local tags to the remote repository. This command publishes tags that are not yet present on the remote.
git push --tagsIn projects with many release tags, this command sends them together instead of pushing them one by one.
Practice Build Tag Push Commands
Add git push origin v2.0.0 followed by git push --tags to a JavaScript array. Use forEach to print each command on a separate line.
Starter code
const pushCommands = [
// Etiket gönderme komutlarını ekle
];
// Komutları yazdırSample solution
const pushCommands = [
"git push origin v2.0.0",
"git push --tags"
];
pushCommands.forEach(command => console.log(command));Expected output
git push origin v2.0.0 git push --tags
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 Which command pushes only the v1.0.0 tag to the origin remote?
- git tag origin v1.0.0
- git pull origin v1.0.0
- git branch origin v1.0.0
- git push origin v1.0.0 Correct answer
Explanation: The git push origin v1.0.0 command pushes the specified tag to the origin remote.
2 Push All Tags to the Remote
git push ____
git push --tags
Explanation: The --tags option pushes all local tags to the remote repository.
3 Tag Push Commands
| Term | Meaning |
|---|---|
git push origin v1.0.0 |
Pushes a specific tag |
git push --tags |
Pushes all tags |
origin |
Remote repository alias |
v1.0.0 |
Name of the tag to push |