git push to remote code example

Example 1: show remote git

# If you require full output and you are on a network that can reach the remote repo where the origin resides 
git remote show origin

Example 2: git remote

git remote add origin <repository url> # adds a repo to your project

git remote								# lists all the repos of your project
git config --get remote.origin.url		# prints the url of a repo
git push origin master					# updates the master branch of your repo

git remote remove origin				# removes the repo from your project

Example 3: git push to branch

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

# Otherwise
git push origin BRANCH

Example 4: git push

# Once a repo is cloned, you'll be working inside of the default branch (the default is `master`)
git clone https://github.com/<git-user>/<repo-name> && cd <repo-name>
# make changes and stage your files (repeat the `git add` command for each file, or use `git add .` to stage all)
git add <filename>
# now commit your code
git commit -m "added some changes to my repo!"
# push changes in `master` branch to github
git push origin master

Example 5: git push origin

git branch -M main

then

git push -u origin main

or 

git push -f origin main

or 

git push origin master --force

Example 6: git push repo

git remote add origin https://github.com/tqisjim/google-oauth.git
git push -u origin master

Tags:

Html Example