git push command

The git push command is used to upload your local repository content (commits) to a remote repository. The following is the basic syntax of git push command. Basic Syntax git push <remote> <branch>
• <remote> is the name of the remote repository (e.g., origin).
• <branch> is the name of the local branch we want to push (e.g., main or master).
Example: To push the local main branch commits to the remote repository named “origin”.

Bash

git push origin main

The command pushes the commits from our local main branch to the main branch on the remote repository named origin. If the remote branch doesn't exist, Git will create it.
If the local branch name and remote branch name is different then we can use the following syntax: Syntax git push <remote> <local-branch>:<remote-branch>
Example: To push the local feature branch to the remote dev branch:

Bash

git push origin feature:dev

This command will push our local feature branch to the dev branch on the remote repository.
git push -all
To push all the local branches to the remote repository.

Bash

git push --all

Pushing Tags
If we have tags that we also want to push to the remote repository, we can use:

Bash

git push --tags