Question:
In Git bash , to update the current local branch from a remote branch , we use the command:
git pull nomeDoRemote nomeDoBranch
Still in bash , when navigating to a project directory, we see something like this:
usuario MINGW64 ~/foo/bar (nomeDoBranch)
That way, it's easy to know the name of a branch to update it – with the assumption that it was created from a remote, or that it is at least published.
But how can we get the name of the remote(s) associated with the project?
Answer:
Using the git remote -v
command, you will see the remote repositories configured in your local project:
marcelo@marcelo-X555LF:/var/www/html/projeto$ git remote -v
origin https://marcelodeandrade@gitserver.org/repositorio/projeto.git (fetch)
origin https://marcelodeandrade@gitserver.org/repositorio/projeto.git (push)
With git ls-remote
you will see the remote repositories associated with the commits:
From https://marcelodeandrade@gitserver.org/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