Work with a remote branch - Anjum219/Git-basics GitHub Wiki

To add a remote branch in your local, copy the HTTPS/SSH link of that remote repository. Open a terminal in your local folder and type-

git remote add <remote_name> <HTTPS/SSH link>

Now, if your local branch and remote branch are diverged, to merge the remote branch into local,

git pull <remote_name> <branch_name>

A window will appear with a suggested commit message. Edit as per your wish or keep it as it is. Then press Ctrl+C+O

Now, a suggested file name will be shown. Keep it or edit it. Then press Enter and press Ctrl+X. It will merge the remote changes with the local.

To remove a remote, simple do

git remote remove <remote_name>

To rename a remote-

git remote rename <remote_old_name> <remote_new_name>