git push

Push local commits to a remote repository

Syntax

git push [<options>] [<remote>] [<refspec>...]

Parameters

ParametersDescriptionExamplesLevel
-u --set-upstream git push -u origin main Common
--force () git push --force
--force-with-lease git push --force-with-lease Advanced
--tags git push --tags Common
-d --delete git push -d origin feature-x Common

Examples

git push origin main

New

git push -u origin feature-login
-u, git push

git push origin --delete feature-old

git push --force-with-lease
New, --force

Common Errors

rejected - non-fast-forwardNew, git pull --rebase
fatal: The current branch has no upstream branchgit push -u origin <branch>

Tips

Related Commands