git push
This command sends your local commits to the remote repository so others (or other machines) can access your latest work and keep the shared branches up to date.
This command uses your current branch and its configured upstream (for example origin/main) and transfers any commits that exist locally but not on the remote; if no upstream is set, Git will prompt you to specify one, often using git push -u origin <branch> where -u (same as --set-upstream) records the remote branch so future plain git push calls know where to send changes. It only pushes commits and references (like branch tips and tags), not uncommitted changes, and will typically fail if the remote branch has new commits you don’t have locally, in which case you’d usually run git pull or git pull --rebase to sync before pushing again.
Closely related variants include git push origin <branch> to explicitly push a specific branch, git push -u origin <branch> to both push and set the upstream for future simple pushes, and git push --force-with-lease to overwrite remote history more safely when you’ve rewritten local commits; you can also use git push origin --tags to upload all tags, or git push origin <tag> for a single tag. Complementary commands are git pull to fetch and integrate remote changes before pushing, git fetch to update remote-tracking branches without merging, and git status to quickly check which branch you’re on and whether it’s ahead or behind its remote.
Examples:
git push origin maingit push -u origin feature/add-login