Push tag

3 snippets across 2 stacks - Git, Docker

Also written as push tags · tag and push

GitGit

Push All Branches

Git · Remote Repositories
Syntax
git push --all <remote>
git push --tags <remote>
Example
git push --all origin
git push --tags origin

Note Pushes every local branch to the remote. Be cautious with this in shared repos - you might push experimental branches others don't want. --tags pushes all tags separately.

Push Tags to Remote

Git · Tags
Syntax
git push origin <tag>
git push origin --tags
Example
# Push a single tag:
git push origin v2.0.0

# Push all tags:
git push origin --tags
Output
To https://github.com/user/project.git
 * [new tag]         v2.0.0 -> v2.0.0

Note Tags are NOT pushed automatically with git push. You must explicitly push them. --tags pushes all local tags that don't exist on the remote.

DKDocker

Tag & Push Workflow

DK · Registry & Distribution
Syntax
docker tag <local_image> <registry>/<repo>:<tag>
docker push <registry>/<repo>:<tag>
Example
docker build -t myapp:1.0 .
docker tag myapp:1.0 ghcr.io/myorg/myapp:1.0
docker tag myapp:1.0 ghcr.io/myorg/myapp:latest
docker push ghcr.io/myorg/myapp:1.0
docker push ghcr.io/myorg/myapp:latest

Note Always push a specific version tag alongside latest. This way, deployments can pin to a known version while latest serves as a convenience pointer for development.

Frequently asked questions

How do you push tag?
This task is covered in 2 stacks on this page: Git, Docker. The "Push All Branches" snippet in Git uses `git push --all <remote>`.
Which command does the Git example use?
The "Push All Branches" snippet uses `git push --all <remote>`, from the Remote Repositories section of the Git cheat sheet.
Which stacks cover "push tag" on this page?
Git, Docker. Together they hold 3 copy-ready snippets for this task.
Is there anything to watch out for?
Yes. For "Push All Branches": Pushes every local branch to the remote. Be cautious with this in shared repos - you might push experimental branches others don't want. --tags pushes all tags separately.