Git remote: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(12 intermediate revisions by the same user not shown)
Line 11: Line 11:
==List the Remotes of the Current Repository==
==List the Remotes of the Current Repository==


git remote -v
<syntaxhighlight lang='bash'>
origin https&#58;//gogs-cicd.apps.openshift.novaordis.io/gogs/novaordis-session-servlet.git (fetch)
git remote -v
origin https&#58;//gogs-cicd.apps.openshift.novaordis.io/gogs/novaordis-session-servlet.git (push)
origin https://gogs-cicd.apps.openshift.novaordis.io/gogs/novaordis-session-servlet.git (fetch)
origin https://gogs-cicd.apps.openshift.novaordis.io/gogs/novaordis-session-servlet.git (push)
</syntaxhighlight>


=Sub-Commands=
=Sub-Commands=
Line 19: Line 21:
==show==
==show==


Provides detailed information about the specified remote:
Provide detailed information about the specified remote:


  git remote show <''remote-name''>
  git remote show <''remote-name''>


==add==
==add==
Add a new remote for the repository at the specified URL, for the current local repository. Once the remote has been established, [[git fetch]] can be used to create and update [[Git_Concepts#Tracking_Branch|remote-tracking branches]].
git remote add <''remote-name''> <''remote-url''>
For the sequence of git commands, including validations, required to fully establish a second remote, see: {{Internal|Git Add Another Remote to an Existing Repository|Add Another Remote to an Existing Repository}}


==update==
==update==
Fetches all updates available in the remote repository:
git remote update <''remote-name''>


==prune==
==prune==
Removes the names of stale local branches - [[Git Concepts#Remote-Tracking_Branch|tracking branches]] that still exist in the local repository but whose corresponding remote branches have been deleted: {{Internal|Git_branch#Prune_Remote_Branches|Prune Remote Branches}}


==remove, rm==
==remove, rm==
Removes the given remote and all its associated tracking branches from the local repository.

Latest revision as of 19:19, 15 April 2024

Internal

Overview

Manages remotes. It can be used to view, create, manipulate and remove a remote. The end result of executing the command is a modification of the corresponding .git/config [remote] entry.

Operations

List the Remotes of the Current Repository

git remote -v
origin	https://gogs-cicd.apps.openshift.novaordis.io/gogs/novaordis-session-servlet.git (fetch)
origin	https://gogs-cicd.apps.openshift.novaordis.io/gogs/novaordis-session-servlet.git (push)

Sub-Commands

show

Provide detailed information about the specified remote:

git remote show <remote-name>

add

Add a new remote for the repository at the specified URL, for the current local repository. Once the remote has been established, git fetch can be used to create and update remote-tracking branches.

git remote add <remote-name> <remote-url>

For the sequence of git commands, including validations, required to fully establish a second remote, see:

Add Another Remote to an Existing Repository

update

Fetches all updates available in the remote repository:

git remote update <remote-name>

prune

Removes the names of stale local branches - tracking branches that still exist in the local repository but whose corresponding remote branches have been deleted:

Prune Remote Branches

remove, rm

Removes the given remote and all its associated tracking branches from the local repository.