Nickool Nickool - 6 months ago 38
Git Question

how to show remote branches of a specific remote

I have three repositories with different names under one folder:


When I want to get the remote branches, I want to do specific remote branches from just one of the repositories, I know that
git branch -r
shows me all of them but I am wondering how to do git branch -r on only one mentioned repository?

I was trying
git branch -r=rep1
git branch --remotes=rep1

However this is not correct, wondering if there is a way to do it?

I have only one directory, inside that directory I have different remote

here is more information:

$ git remote -v
remote1 https://url/rep1.git (fetch)
remote1 https://url/rep1.git (push)
remote2 https://url/rep2.git (fetch)
remote2 https://url/rep2.git (push)
remote3 https://url/rep3.git (fetch)
remote3 https://url/rep3.git (push)

Answer Source

One quick approach could be to use grep after your git command like this:

git branch --remote | grep rep2
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download