Git Cheatsheet - Quick Git Command Reference

Quick reference for common Git commands. Search, copy, and use Git commands instantly.

Share
Back to Git Cheatsheet

git push

Push local commits to remote repository

Syntax

git push [options] [<remote>] [<branch>]

Common Options

OptionDescription
-u, --set-upstreamSet upstream tracking branch
-f, --forceForce push (use with caution)
--force-with-leaseForce push with lease (safer)
--allPush all branches
--tagsPush all tags
--follow-tagsPush tags following commits
-d, --deleteDelete remote branch
--dry-runPreview push operation

Examples

git push

Push to default remote branch

git push -u origin main

First push and set upstream

git push --force-with-lease

Safe force push with lease

git push origin --delete old-branch

Delete remote branch

git push origin --tags

Push all local tags

Related Tools

More Code & Dev Tools