git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* getting pull and push URLs for the current branch
@ 2018-04-08 10:15 Michal Novotny
  2018-04-08 11:46 ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 2+ messages in thread
From: Michal Novotny @ 2018-04-08 10:15 UTC (permalink / raw)
  To: git

Hello,

is there a way to get remote url  for the current branch? That is the
url that will be used when I call `git pull`. It doesn't seem to be a
particularly easy task.

Thank you!
clime

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: getting pull and push URLs for the current branch
  2018-04-08 10:15 getting pull and push URLs for the current branch Michal Novotny
@ 2018-04-08 11:46 ` Ævar Arnfjörð Bjarmason
  0 siblings, 0 replies; 2+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2018-04-08 11:46 UTC (permalink / raw)
  To: Michal Novotny; +Cc: git


On Sun, Apr 08 2018, Michal Novotny wrote:

> is there a way to get remote url  for the current branch? That is the
> url that will be used when I call `git pull`. It doesn't seem to be a
> particularly easy task.

You'd do something like this (sans error checking):

    git remote get-url $(git config branch.$(git rev-parse --abbrev-ref HEAD).remote)

I.e. your HEAD may have remote tracking info set up, this'll get the
remote URL for the remote it points at.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-04-08 11:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-08 10:15 getting pull and push URLs for the current branch Michal Novotny
2018-04-08 11:46 ` Ævar Arnfjörð Bjarmason

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).