Get the name of the remote

4

bash of Git, to update the local branch in use from a remote branch , we use the command: p>

git pull nomeDoRemote nomeDoBranch

In , when navigating to the directory of a project, we see something like this:

usuario MINGW64 ~/foo/bar (nomeDoBranch)

In this way, it is easy to know the name of a branch to update it - with the assumption that it was created from a remote, or at least published. >

But how can we get the name of the remote (s) associated with the project?

    
asked by anonymous 11.07.2017 / 20:17

2 answers

7

Using the git remote -v command, you will see the remote repositories configured in your local project:

/ p>

marcelo@marcelo-X555LF:/var/www/html/projeto$ git remote -v
origin  https://[email protected]/repositorio/projeto.git (fetch)
origin  https://[email protected]/repositorio/projeto.git (push)

With git ls-remote you will see the remote repositories associated with the commits:

From https://[email protected]/repositorio/projeto.git
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx        HEAD
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx        refs/heads/dev
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx        refs/heads/feature#10915
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx        refs/heads/feature#12617
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx        refs/heads/feature#14391
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx        refs/heads/master
    
11.07.2017 / 20:29
1

Or you can use the git remote show command:

$ git remote show
origin
    
04.08.2017 / 15:52