Re: Archiving tags/branches?
- From
SZEDER Gábor <szeder@ira.uka.de>
- Date
- Oct 18, 2008, 10:23 UTC
- Message-ID
- <20081018102345.GA3749@neumann>
- In-Reply-To
- <48F93F52.4070506@pcharlan.com>
Hi Pete,
On Fri, Oct 17, 2008 at 06:43:46PM -0700, Pete Harlan wrote:
Show 10 quoted lines
> If I wanted to archive those, it looks like this would work: > > mkdir .git/refs/archived-tags > cp -a .git/refs/tags/* .git/refs/archived-tags > git tag -d <tag-to-hide> # repeat as necessary > > I can then maintain a short list of tags that currently interest me, but > am guaranteed not to lose old branches (say) referenced by those tags. > > Is there a reason this won't work?
Yes:
$ git --version git version 1.6.0.2.574.g7d0e0 $ git init Initialized empty Git repository in /home/szeder/tmp/git/archive/.git/ $ echo 1 >foo $ git add foo $ git commit -m bar Created initial commit 0c92489: bar 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 foo $ git tag t $ git update-ref refs/archived-tags/t t $ git tag -d t Deleted tag 't' $ cat .git/refs/archived-tags/t 0c92489da6ec6dfd9875eb590d820fcceb01829b $ git gc Counting objects: 3, done. Writing objects: 100% (3/3), done. Total 3 (delta 0), reused 0 (delta 0) $ cat .git/refs/archived-tags/t cat: .git/refs/archived-tags/t: No such file or directory
So, if you put any tags or branches under refs/whatever-non-standard/, then it gets deleted when you gc (or when gc is run automatically).
I don't know whether this behaviour is intentional or not, but I have experienced this the hard way recently.
Regards, Gábor