Live data from Hacker News

Archiving Git branches as tags

etc.octavore.com

31–40 of 49 posts

Re: Archiving Git branches as tags

#31

Earlier quoted context omitted.

I sometimes leave merged branches around for quite a while, because I squash them when I merge to master and sometimes when tracking down a bug the ability to bisect very handy.

What made you decide to squash when merging instead of leaving the commits in the history so you can always bisect?

The range reason your history textbook is not infinitely long. The longer something is, the less digestible. When we need more granularity, it's there in the branches.

Re: Archiving Git branches as tags

#32

On a related note, git supports incorporating custom commands via executables available in the `PATH` having the naming convention of: git- Where "command name" in this case would be `archive-branch` and could be defined thusly: #!/bin/sh # git-archive-branch git_branch="${1:-$(git branch --show-current)}" git co main && git tag archive/$git_branch $git_branch && git branch -D $git_branch It then could be invoked the…

Oh oh. Your co alias leaked :)

Re: Archiving Git branches as tags

#33

On a related note, git supports incorporating custom commands via executables available in the `PATH` having the naming convention of: git- Where "command name" in this case would be `archive-branch` and could be defined thusly: #!/bin/sh # git-archive-branch git_branch="${1:-$(git branch --show-current)}" git co main && git tag archive/$git_branch $git_branch && git branch -D $git_branch It then could be invoked the…

Why is this useful? Why would someone care about typing `git archive-branch` instead of `git-archive-branch`?

Re: Archiving Git branches as tags

#35

On a related note, git supports incorporating custom commands via executables available in the `PATH` having the naming convention of: git- Where "command name" in this case would be `archive-branch` and could be defined thusly: #!/bin/sh # git-archive-branch git_branch="${1:-$(git branch --show-current)}" git co main && git tag archive/$git_branch $git_branch && git branch -D $git_branch It then could be invoked the…

Why is this useful? Why would someone care about typing `git archive-branch` instead of `git-archive-branch`?

Consistency: not needing to remember under which alternative methods any command was found under.

Re: Archiving Git branches as tags

#36

I don't see the point of this. A git branch is already a kind of tag. How about just # rename branch to archive/ prefix to indicate it is archived git branch -m foo-branch archive/foo-branch

Branches are expected to change, tags are not. Tags are also mildly harder to change. A tag seems more apt for an archived branch. So I sort of see where OP comes from.

Re: Archiving Git branches as tags

#37
post #14

Earlier quoted context omitted.

Hooks only keep honest people honest :) and an LLM will happily clobber a tag and skip hooks while the user just spams “accept”.

That's true for local hooks, but neither a dishonest person nor an LLM can bypass a pre-receive hook on the server (as long as they don't have admin access).

Thanks, apparently most people here aren't familiar with server-side hooks.

Re: Archiving Git branches as tags

#38
post #14

Earlier quoted context omitted.

Hooks only keep honest people honest :) and an LLM will happily clobber a tag and skip hooks while the user just spams “accept”.

Can't solve culture problems with technology, but we all know that by now, right?

[dead]

Re: Archiving Git branches as tags

#39

I don't see the point of this. A git branch is already a kind of tag. How about just # rename branch to archive/ prefix to indicate it is archived git branch -m foo-branch archive/foo-branch

FWIW, this is what I do, although typically with the prefix `dead/`, unto which I abandon ideas and misdirected refactoring with reckless abandon.

Re: Archiving Git branches as tags

#40
post #36

I don't see the point of this. A git branch is already a kind of tag. How about just # rename branch to archive/ prefix to indicate it is archived git branch -m foo-branch archive/foo-branch

Branches are expected to change, tags are not. Tags are also mildly harder to change. A tag seems more apt for an archived branch. So I sort of see where OP comes from.

Yeah. But WHY taging instead of renaming the branch ? I don't say if it is a good or bad idea. But I would like to know why.
Post reply on HN