# Git ghost references

3 messages from 2012-01-02 to 2012-01-03. Participants: Chris Leong, Johannes Sixt.
Thread: https://gitlist.dev/t/29282

## Chris Leong, 2012-01-02 23:42

Subject: Git ghost references
Message-ID: <CAJ6vYjfpx-hfDsd+urp5_iS99p0RhmxohOc+TNv7SUWFnYe5wQ@mail.gmail.com>
URL: https://gitlist.dev/e/CAJ6vYjfpx-hfDsd%2Burp5_iS99p0RhmxohOc%2BTNv7SUWFnYe5wQ%40mail.gmail.com

```
I seem to have a "ghost reference" - ie. I can check out a reference
that doesn't appear to exist. Does anyone know what might cause this?

~/gaf-cvs (project-membership)$ g show-ref | grep production
~/gaf-cvs (project-membership)$ g gc --prune=now
Counting objects: 117306, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (25270/25270), done.
Writing objects: 100% (117306/117306), done.
Total 117306 (delta 83839), reused 117283 (delta 83820)
~/gaf-cvs (project-membership)$ g co production
Note: checking out 'production'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD is now at ae5b621... Merge branch 'master' of git.freelancer.com:production
~/gaf-cvs ((no branch))$

```

## Johannes Sixt, 2012-01-03 08:23

Subject: Re: Git ghost references
Message-ID: <4F02BAF9.1000206@kdbg.org>
URL: https://gitlist.dev/e/4F02BAF9.1000206%40kdbg.org
In-Reply-To: <CAJ6vYjfpx-hfDsd+urp5_iS99p0RhmxohOc+TNv7SUWFnYe5wQ@mail.gmail.com>

```
Am 03.01.2012 00:42, schrieb Chris Leong:
> I seem to have a "ghost reference" - ie. I can check out a reference
> that doesn't appear to exist. Does anyone know what might cause this?
> 
> ~/gaf-cvs (project-membership)$ g show-ref | grep production
> ~/gaf-cvs (project-membership)$ g co production
> Note: checking out 'production'.
> ...

The most likely reason is that you have a ref 'production' directly in
the .git directory. Perhaps you or one of your scripts created it
accidentally using 'git update-ref production ae5b621', i.e., without
giving the full ref path name.

-- Hannes

```

## Chris Leong, 2012-01-03 08:32

Subject: Re: Git ghost references
Message-ID: <CAJ6vYjd2YLUa82tUrXq+N=7+kdVxH8ryS64mKKkwhA6K+QfcDw@mail.gmail.com>
URL: https://gitlist.dev/e/CAJ6vYjd2YLUa82tUrXq%2BN%3D7%2BkdVxH8ryS64mKKkwhA6K%2BQfcDw%40mail.gmail.com
In-Reply-To: <4F02BAF9.1000206@kdbg.org>

```
I did have a production file in my .git and also an empty folder left
in my remotes. Thanks heaps!

On Tue, Jan 3, 2012 at 7:23 PM, Johannes Sixt <j6t@kdbg.org> wrote:
> Am 03.01.2012 00:42, schrieb Chris Leong:
>> I seem to have a "ghost reference" - ie. I can check out a reference
>> that doesn't appear to exist. Does anyone know what might cause this?
>>
>> ~/gaf-cvs (project-membership)$ g show-ref | grep production
>> ~/gaf-cvs (project-membership)$ g co production
>> Note: checking out 'production'.
>> ...
>
> The most likely reason is that you have a ref 'production' directly in
> the .git directory. Perhaps you or one of your scripts created it
> accidentally using 'git update-ref production ae5b621', i.e., without
> giving the full ref path name.
>
> -- Hannes

```
