git push Upload your commits to a remote
Sends commits from your local branch to a remote repository such as GitHub so others can see them. It fails if the remote has commits you do not have, to protect their work.
Synopsis
git push [OPTION]... [REMOTE [BRANCH]]
Common options
| Option or form | What it does |
|---|---|
-u, --set-upstream | Remember the remote branch so later git push and git pull need no arguments |
--force-with-lease | Overwrite the remote only if nobody else has pushed since you last fetched |
--tags | Push all tags |
--delete BRANCH | Delete a branch on the remote |
-n, --dry-run | Show what would be pushed |
--force, -f | Overwrite the remote regardless. Risky on shared branches |
Examples
git push
git push -u origin feature/search
branch 'feature/search' set up to track 'origin/feature/search'.
git push --force-with-lease
git push origin --delete feature/search
git push origin v1.2.0
Notes
- If push is rejected, run git pull --rebase (or merge), fix any conflicts, then push again.
- Prefer --force-with-lease over --force. It will not clobber work you have not seen.
- Pushing does not open a pull request. Use gh pr create for that.
See also
Last reviewed 2026-10-09.