{"thread":{"id":"17445","subject":"\"git gc\" removes \".git/refs/heads/master\".","startedAt":"2009-01-29T19:31:17Z","lastAt":"2009-01-29T20:07:05Z","messageCount":5,"participants":["Bernd Lommerzheim","Johannes Schindelin","Johannes Gilger","Peter Baumann","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"102493","messageId":"83c97f59a5a5e59f908f3fc125d26adb@lunox.net","threadId":"17445","inReplyTo":null,"subject":"\"git gc\" removes \".git/refs/heads/master\".","fromName":"Bernd Lommerzheim","fromEmail":"bernd@lommerzheim.com","sentAt":"2009-01-29T19:31:17Z","receivedAt":"2009-01-29T19:31:17Z","isPatch":false,"sender":{"key":"bernd@lommerzheim.com","avatar":null},"body":"Hi,\n\nmaybe I found a bug in git. When I execute \"git gc\" in my local repository,\ngit removes the file \".git/refs/heads/master\". Is this an intended behavior\n(but why?) or is that a bug?\n\nSome commands to reproduce:\n~ $ mkdir tmp; cd tmp\n~/tmp $ git init\nInitialized empty Git repository in /home/myuser/tmp/.git/\n~/tmp $ echo \"content\" > a\n~/tmp $ git add .\n~/tmp $ git commit -a -m \"first commit\"\nCreated initial commit 0b67f33: first commit\n 1 files changed, 1 insertions(+), 0 deletions(-)\n create mode 100644 a\n~/tmp $ cat .git/refs/heads/master\n0b67f33fff4152a912fdbe8819480b8fc1f2e990\n~/tmp $ git gc\nCounting objects: 3, done.\nWriting objects: 100% (3/3), done.\nTotal 3 (delta 0), reused 0 (delta 0)\n~/tmp $ cat .git/refs/heads/master\ncat: .git/refs/heads/master: No such file or directory\n~/tmp $ cat .git/HEAD\nref: refs/heads/master\n~/tmp $ \n\nI tested this with git v1.6.0.6, v1.6.1.1 and the current master\n(a34a9dbb..).\n\n\nBest regards,\n\nBernd Lommerzheim\n"},{"id":"102495","messageId":"alpine.DEB.1.00.0901292050050.3586@pacific.mpi-cbg.de","threadId":"17445","inReplyTo":"83c97f59a5a5e59f908f3fc125d26adb@lunox.net","subject":"Re: \"git gc\" removes \".git/refs/heads/master\".","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-29T19:50:33Z","receivedAt":"2009-01-29T19:50:33Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 29 Jan 2009, Bernd Lommerzheim wrote:\n\n> maybe I found a bug in git. When I execute \"git gc\" in my local \n> repository, git removes the file \".git/refs/heads/master\". Is this an \n> intended behavior (but why?) or is that a bug?\n\nNo, it packs the refs.  You have no business accessing files in .git/ \ndirectly :-)\n\nCiao,\nDscho\n"},{"id":"102496","messageId":"glt1bl$mal$1@ger.gmane.org","threadId":"17445","inReplyTo":"83c97f59a5a5e59f908f3fc125d26adb@lunox.net","subject":"Re: \"git gc\" removes \".git/refs/heads/master\".","fromName":"Johannes Gilger","fromEmail":"heipei@hackvalue.de","sentAt":"2009-01-29T19:51:17Z","receivedAt":"2009-01-29T19:51:17Z","isPatch":false,"sender":{"key":"heipei@hackvalue.de","avatar":"https://avatars.githubusercontent.com/u/6072?v=4"},"body":"On 2009-01-29, Bernd Lommerzheim <bernd@lommerzheim.com> wrote:\n> maybe I found a bug in git. When I execute \"git gc\" in my local repository,\n> git removes the file \".git/refs/heads/master\". Is this an intended behavior\n> (but why?) or is that a bug?\n\nGood question, and I just found that one out myself. The ref has been \n\"packed\" (git help pack-refs) and can be found in .git/packed-refs. Hope \nthat answers your question.\n\nGreetings,\nJojo\n\n-- \nJohannes Gilger <heipei@hackvalue.de>\nhttp://hackvalue.de/heipei/\nGPG-Key: 0x42F6DE81\nGPG-Fingerprint: BB49 F967 775E BB52 3A81  882C 58EE B178 42F6 DE81\n"},{"id":"102497","messageId":"20090129195526.GA15475@m62s10.vlinux.de","threadId":"17445","inReplyTo":"83c97f59a5a5e59f908f3fc125d26adb@lunox.net","subject":"Re: \"git gc\" removes \".git/refs/heads/master\".","fromName":"Peter Baumann","fromEmail":"waste.manager@gmx.de","sentAt":"2009-01-29T19:55:26Z","receivedAt":"2009-01-29T19:55:26Z","isPatch":false,"sender":{"key":"waste.manager@gmx.de","avatar":null},"body":"On Thu, Jan 29, 2009 at 08:31:17PM +0100, Bernd Lommerzheim wrote:\n> Hi,\n> \n> maybe I found a bug in git. When I execute \"git gc\" in my local repository,\n> git removes the file \".git/refs/heads/master\". Is this an intended behavior\n> (but why?) or is that a bug?\n> \n\nThis is intential, as git gc creates .git/packed-refs in which the\ncontents of your master branch are stored. The packed-refs help speeding\nup the listing of your branches if you have many of them (e.g. many old\nhistorical ones).\n\nRegards,\nPeter Baumann\n"},{"id":"102499","messageId":"7vy6wtev12.fsf@gitster.siamese.dyndns.org","threadId":"17445","inReplyTo":"83c97f59a5a5e59f908f3fc125d26adb@lunox.net","subject":"Re: \"git gc\" removes \".git/refs/heads/master\".","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-01-29T20:07:05Z","receivedAt":"2009-01-29T20:07:05Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Bernd Lommerzheim <bernd@lommerzheim.com> writes:\n\n> Hi,\n>\n> maybe I found a bug in git. When I execute \"git gc\" in my local repository,\n> git removes the file \".git/refs/heads/master\". Is this an intended behavior\n> (but why?) or is that a bug?\n>\n> Some commands to reproduce:\n> ~ $ mkdir tmp; cd tmp\n> ~/tmp $ git init\n> Initialized empty Git repository in /home/myuser/tmp/.git/\n> ~/tmp $ echo \"content\" > a\n> ~/tmp $ git add .\n> ~/tmp $ git commit -a -m \"first commit\"\n> Created initial commit 0b67f33: first commit\n>  1 files changed, 1 insertions(+), 0 deletions(-)\n>  create mode 100644 a\n> ~/tmp $ cat .git/refs/heads/master\n> 0b67f33fff4152a912fdbe8819480b8fc1f2e990\n> ~/tmp $ git gc\n> Counting objects: 3, done.\n> Writing objects: 100% (3/3), done.\n> Total 3 (delta 0), reused 0 (delta 0)\n> ~/tmp $ cat .git/refs/heads/master\n> cat: .git/refs/heads/master: No such file or directory\n> ~/tmp $ cat .git/HEAD\n> ref: refs/heads/master\n> ~/tmp $ \n\n$ grep master .git/packed-refs\n"}]}