threads / discuss / 37002

Is it possible to list unpushed tags without accessing remote?

Subject: Is it possible to list unpushed tags without accessing remote?

## tl;dr

6 messages between Jun 26, 2014 and Jun 27, 2014.

replies: 5people: 4as markdown or json

Kirill Likhodedov· Jun 26, 2014, 12:42 UTC · lore
Hi,
is it possible to know which tags are not yet pushed to a remote via a completely local command?
(e.g. the list of unpushed _commits_ may be received by ‘git log <upstream>..’)

I know it is possible to execute 'git ls-remote’ or 'git push --dry-run’, but both ask the remote server. I’m almost sure that the answer is “NO”, but want to receive a confirmation from Git gurus :)

Thanks a lot! -- Kirill.

Shawn Pearce· Jun 26, 2014, 16:13 UTC · re: Kirill Likhodedov · lore

Re: Is it possible to list unpushed tags without accessing remote?

On Thu, Jun 26, 2014 at 5:42 AM, Kirill Likhodedov <kirill.likhodedov@jetbrains.com> wrote:

Show 6 quoted lines
> is it possible to know which tags are not yet pushed to a remote via a completely local command?
>
> (e.g. the list of unpushed _commits_ may be received by ‘git log <upstream>..’)
>
> I know it is possible to execute 'git ls-remote’ or 'git push --dry-run’, but both ask the remote server.
> I’m almost sure that the answer is “NO”, but want to receive a confirmation from Git gurus :)
No. The client doesn't track what tags the remote has.

You may be able to guess by looking at `git log --decorate upstream..` and seeing which tags, if any show up.

Andreas Schwab· Jun 26, 2014, 16:54 UTC · re: Shawn Pearce · lore

Re: Is it possible to list unpushed tags without accessing remote?

Shawn Pearce <spearce@spearce.org> writes:
Show 10 quoted lines
> On Thu, Jun 26, 2014 at 5:42 AM, Kirill Likhodedov
> <kirill.likhodedov@jetbrains.com> wrote:
>> is it possible to know which tags are not yet pushed to a remote via a completely local command?
>>
>> (e.g. the list of unpushed _commits_ may be received by ‘git log <upstream>..’)
>>
>> I know it is possible to execute 'git ls-remote’ or 'git push --dry-run’, but both ask the remote server.
>> I’m almost sure that the answer is “NO”, but want to receive a confirmation from Git gurus :)
>
> No. The client doesn't track what tags the remote has.

Not by default, but it is easy to configure your clone to fetch tags to a separate namespace.

Andreas.
-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
Junio C Hamano· Jun 26, 2014, 19:04 UTC · re: Andreas Schwab · lore

Re: Is it possible to list unpushed tags without accessing remote?

Andreas Schwab <schwab@linux-m68k.org> writes:
Show 15 quoted lines
> Shawn Pearce <spearce@spearce.org> writes:
>
>> On Thu, Jun 26, 2014 at 5:42 AM, Kirill Likhodedov
>> <kirill.likhodedov@jetbrains.com> wrote:
>>> is it possible to know which tags are not yet pushed to a remote via a completely local command?
>>>
>>> (e.g. the list of unpushed _commits_ may be received by ‘git log <upstream>..’)
>>>
>>> I know it is possible to execute 'git ls-remote’ or 'git push --dry-run’, but both ask the remote server.
>>> I’m almost sure that the answer is “NO”, but want to receive a confirmation from Git gurus :)
>>
>> No. The client doesn't track what tags the remote has.
>
> Not by default, but it is easy to configure your clone to fetch tags to
> a separate namespace.

But then in order to learn what tags the remote has, you need to talk to the remote and it won't be "complately a local" operation anymore, no?

Kirill Likhodedov· Jun 26, 2014, 19:20 UTC · re: Junio C Hamano · lore

Re: Is it possible to list unpushed tags without accessing remote?

On 26 Jun 2014, at 23:04 , Junio C Hamano <gitster@pobox.com> wrote:
Show 8 quoted lines
> Andreas Schwab <schwab@linux-m68k.org> writes:
> 
>> Not by default, but it is easy to configure your clone to fetch tags to
>> a separate namespace.
> 
> But then in order to learn what tags the remote has, you need to
> talk to the remote and it won't be "complately a local" operation
> anymore, no?
If I understand the solution correctly, it looks like it is not needed, if I’m OK with knowing which tags the remote had during the last fetch. 
Just like with commits: 'git log origin/master..’ can give me incorrect results if e.g. commits were rebased on the remote site. But we usually ignore such possibility as improbable.
Andreas Schwab· Jun 27, 2014, 07:41 UTC · re: Junio C Hamano · lore

Re: Is it possible to list unpushed tags without accessing remote?

Junio C Hamano <gitster@pobox.com> writes:
> But then in order to learn what tags the remote has, you need to
> talk to the remote and it won't be "complately a local" operation
> anymore, no?

Just like for every other remote ref. If you need to know the ultimative truth the only way is to ask the remote. Your local copy is just a cache that may be outdated any time.

Andreas.
-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

← back to recent threads