Difference between revisions of "Git/remote"

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
< Git
Jump to navigation Jump to search
(quick note)
 
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
==Examples==
 
==Examples==
 +
* '''git remote add {{arg|server alias}} {{arg|URL}}'''
 +
** adds a remote server
 +
** Note that although these URLs typically end in ".git" (on GitHub and similar services), they're actually the user-relative path to the folder containing the Git repository. (A valid repository will always contain a .git folder.)
 
* '''git remote''' -v
 
* '''git remote''' -v
 
** lists aliases of remote servers
 
** lists aliases of remote servers
 +
* '''git remote''' show
 +
** seems to just list remote server aliases
 +
* '''git remote''' show {{arg|server alias}}
 +
** displays information about a remote server
 +
===from the Manpage===
 +
Add a new remote, fetch, and check out a branch from it:
 +
 +
              $ git remote
 +
              origin
 +
              $ git branch -r
 +
                origin/HEAD -> origin/master
 +
                origin/master
 +
              $ git remote add staging git://git.kernel.org/.../gregkh/staging.git
 +
              $ git remote
 +
              origin
 +
              staging
 +
              $ git fetch staging
 +
              ...
 +
              From git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
 +
                * [new branch]      master    -> staging/master
 +
                * [new branch]      staging-linus -> staging/staging-linus
 +
                * [new branch]      staging-next -> staging/staging-next
 +
              $ git branch -r
 +
                origin/HEAD -> origin/master
 +
                origin/master
 +
                staging/master
 +
                staging/staging-linus
 +
                staging/staging-next
 +
              $ git checkout -b staging staging/master
 +
==Reference==
 +
* {{l/manpage|git-remote|manpage}}

Latest revision as of 12:59, 28 September 2023

Examples

  • git remote add <server alias> <URL>
    • adds a remote server
    • Note that although these URLs typically end in ".git" (on GitHub and similar services), they're actually the user-relative path to the folder containing the Git repository. (A valid repository will always contain a .git folder.)
  • git remote -v
    • lists aliases of remote servers
  • git remote show
    • seems to just list remote server aliases
  • git remote show <server alias>
    • displays information about a remote server

from the Manpage

Add a new remote, fetch, and check out a branch from it:

              $ git remote
              origin
              $ git branch -r
                origin/HEAD -> origin/master
                origin/master
              $ git remote add staging git://git.kernel.org/.../gregkh/staging.git
              $ git remote
              origin
              staging
              $ git fetch staging
              ...
              From git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
               * [new branch]      master     -> staging/master
               * [new branch]      staging-linus -> staging/staging-linus
               * [new branch]      staging-next -> staging/staging-next
              $ git branch -r
                origin/HEAD -> origin/master
                origin/master
                staging/master
                staging/staging-linus
                staging/staging-next
              $ git checkout -b staging staging/master

Reference