git push
Updates remote refs along with associated objects.
Syntax
git push [<options>] [<remote>] [<refspec>...]
Options
- -u / --set-upstream: Sets the upstream tracking reference for the branch
- --force / -f: Forces the push, overwriting remote history
- --force-with-lease: Safer force push that fails if the remote has new commits
- --tags: Pushes all tags to the remote
- --delete: Deletes a remote branch
- --all: Pushes all branches
- --dry-run: Shows what would be pushed without actually pushing
Example
git push origin main git push -u origin feature/login git push --tags git push origin --delete old-branch
Tip
Prefer --force-with-lease over --force to avoid accidentally overwriting others' work.