LinuxCommandLibrary

git-push

TLDR

Push to remote

$ git push [origin] [branch]
copy
Push and set upstream
$ git push -u [origin] [branch]
copy
Push all branches
$ git push --all
copy
Push tags
$ git push --tags
copy
Force push
$ git push --force-with-lease
copy

SYNOPSIS

git push [options] [remote] [refspec]

DESCRIPTION

git push uploads local commits to a remote repository. It updates remote refs with local refs, transferring objects needed to complete the refs.
The command is how local work becomes shared with others. Force push options handle diverged histories, though they should be used carefully. Upstream tracking simplifies future pushes.
git push shares local commits with remote repositories.

PARAMETERS

REMOTE

Remote repository name.
REFSPEC
Refs to push.
-u, --set-upstream
Set upstream tracking.
--all
Push all branches.
--tags
Push tags.
--force
Force update remote refs.
--force-with-lease
Safe force push.
--delete
Delete remote ref.
--dry-run
Show what would be pushed.
--help
Display help information.

CAVEATS

Force push overwrites remote history. Use --force-with-lease for safety. Branch protection may restrict pushes.

HISTORY

git push is a core Git command from initial release, implementing the distributed workflow by enabling commit sharing.

SEE ALSO

Copied to clipboard