How to use Remote Repositories?

Submitted by Rajasekhar on Sat, 11/10/2018 - 13:16
  1. In order to share work with other programmers, we need to send to and pull changes from remote repositories. We can manage our repositories’ remotes using the Git remote command.
    • Use Git remote to show our configured remote repositories.
    • Add or remove remotes.
    • Fetch and merge changes into your local repository.
  2. Using Remote Repositories – Remote Repositories are copies of a repository hosted somewhere on the internet or your network. Allow you to collaborate with other developers. Remotes can be added or removed when needed.
  3. git remote command is used to add a new remote. To see remote connections for the current repository.
    • git remote

  1. To add a new remote connection.

  1. All other commands used when working on Remote Repositories.
    • git remote – Shows all configured remotes.
    • git remote add <shortname> <url> - Add a new remote with name short name.
    • git fetch <shortname> - Download all the changes from this remote.
    • git pull – Shorthand for git fetch && git merge origin/master master.
    • git push <remote> <branch> - Push the contents of a branch to a given remote.
    • Git remote show <shortname> - show the remote’s details.
    • Git remote remove <shortname> - Remove a remote.