How to Push Commits to a Remote in Git (git push)
git push uploads your local commits to a remote repository, updating the branch there to match your local branch.
Published September 27, 2026
git push uploads your local commits to a remote repository, updating the branch there to match your local branch.
Key points
- git push origin main pushes the local main branch to the 'origin' remote
- git push -u origin feature-branch pushes and sets up tracking, so future plain "git push" calls know where to go
- A push is rejected if the remote branch has commits your local branch doesn't — pull or fetch first to reconcile
Example
git push origin main