logoalt Hacker News

Archiving Git branches as tags

54 pointsby octavorelast Monday at 6:52 PM16 commentsview on HN

Comments

derriztoday at 10:10 PM

> Important note: the strange magic requires the official git completion script.

I dislike the official git completion script because it’s so slow when working with large repos. On macOS - because of vagaries of the way its file system works - with large repos it’s effectively unusable. Hint to completion script writers: if your “smart” completion ever takes seconds, it’s worse than useless and far worse than “dumb” filename completion.

ziml77today at 8:17 PM

Seems like a sensible way to archive branches. It's not like a tag and branch are actually very different anyway, right? A tag is a pointer that always refers to the same commit while a branch is a pointer that follows commits forward. And for something that's archived, you don't need the pointer updating mechanism.

show 2 replies
PunchyHamstertoday at 8:24 PM

How often did you go back to the archived tagches that are older than say, 6 months ? Seems very niche, unless dunno, there are no version tags in the repo.

show 1 reply
tonymettoday at 9:14 PM

IMO a cleaner way to do this is with a headless remote, either on disk or “backed up” on a server. `git push —-all` won’t delete refs on the remote, so you don’t have to do any additional work to record or recover them.

`git push —all backup` will record all of your refs and tags

If you are archiving branches in your own rep, prefix with `ar/` so you can grep -v to conceal them.

See also `git notes` to record metadata an against a commit without changing the commit