how to push to a remote repository code example

Example 1: git push to branch

# If its your first push
git push -u origin BRANCH

# Otherwise
git push origin BRANCH

Example 2: git push new repo to remote

$ git remote add origin <remote repository URL>
# Sets the new remote

# Push the changes in your local repository to GitHub.
$ git push -u origin master
# Pushes the changes in your local repository up to the remote repository you specified as the origin

Example 3: how to push code to another remote git repository

git remote rename origin upstream
git remote add origin URL_TO_GITHUB_REPO
git push origin master

Example 4: git remote push

git push  <REMOTENAME> <BRANCHNAME>

Example 5: github Push local branch to Remote

git push origin <Branch_Name>

Example 6: git push remote

git push -u origin master // where 'master' is branch name