Command Palette

Search for a command to run...

Назад к скиллам
скилл № 31835

hoc-git-branch

Conventions for the branches a repository carries — trunks, general branches, and the commits that open and merge them. Use before cutting a branch, merging…

БесплатноЗапускает вложенные скрипты
openreachtechот openreachtech★ 17 звёзд на GitHub

Установить hoc-git-branch в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

Git Branch

Conventions for the branches a repository carries — which one is a trunk, what a general branch is called, the commit that opens a trunk and the commit that closes a sub-branch.

What belongs in a single commit, and how a subject is worded, are settled by the git commit convention. The two commits described here are the exception it points at: their subjects are specified in full below, because what they say is inseparable from what they are for.

No commit is made directly on main, release/x.x.x, dev or env

A commit that carries a change of its own is never made while one of these four is checked out, whatever the change is. The only way a change reaches them is a branch merged back. The two a trunk makes about itself carry none, and the bullet below names them. hotfix/xxxx is not among the four; it is the one trunk worked on directly, as described under the trunk branch below.

  • Read the branch name before the first edit, and again before every commit. Run git branch --show-current. Where the answer is one of the four, cut a branch for the change before touching a file, and commit there. Uncommitted edits travel with git switch -c, so noticing late costs nothing as long as nothing has been committed yet.

  • Where no branch other than those four exists, a new one is created, without exception. There is no branch to work on, so the work does not start until one exists. A repository whose branches are all trunks, or a checkout sitting on one with nothing else cut yet, is not a case for committing there. The work always goes onto a newly created branch, and its commits are made on that branch, with no exception.

  • Size, speed and tidiness are not exceptions. "One line", "a typo", "the tree is clean", "I will move it to a branch afterwards" — none of them makes a direct commit permissible, and a commit that is going to be moved is still a commit made on the trunk.

  • Two commits are the only ones a trunk makes itself, and neither carries a change of its own: the marker that opens it and the Merge … commit that brings a sub-branch in. Both are described below.

  • A commit already made on one of the four is recovered, and the recovery is not optional. Noticing late does not end the work at a report. Say which branch and which commits, then put the line back: the commits are given a branch of their own, and the trunk returns to where it stood.

    git branch <branch>                   # the commits are held by a ref of their own
    git rebase --onto origin/<trunk> @    # the trunk goes back
    git switch <branch>
    
    • The branch is made before anything moves. git branch names the tip without switching, so the commits are held before the trunk is touched. Stopped after that one command, the recovery has lost nothing and can be picked up again.

    • git rebase --onto <target> @ rather than a reset. The range @..HEAD is empty, so nothing is replayed and the branch simply arrives at <target>. Where a tracked file is modified the rebase refuses and moves nothing, which is the whole of what separates it from git reset --hard.

    • Why the reset is refused rather than merely preferred against belongs next door. /hoc-git-prohibit-destructive-commands is the convention that bars it, and the stash below is that convention's mechanism, borrowed here. What this one settles is the shape of the recovery: which ref holds the commits, where the trunk returns to, and which branch the pop happens on.

    • That refusal is what asks for git stash. The open edits belong to the work rather than to the trunk, so they are set aside before the rebase and taken back after the switch:

      git branch <branch>
      git stash -u
      git rebase --onto origin/<trunk> @
      git switch <branch>
      git stash pop
      
      • -u, so that untracked files go with it. Only one the rebase would have to overwrite stops it, but all of them are part of the open work, and leaving any behind splits it across two places.
      • The pop happens on <branch>, not back where the stash was taken. The stray commits changed the tree, the open edits may touch what they changed, and the rewound trunk no longer carries any of it while <branch> still does. This is where the ordinary stash-rebase-pop order does not reach: there the branch comes back to the work, and here the trunk is moved away from it.
      • Measured: with the open edit touching a file one of the stray commits had added, popping on the rewound trunk came back DU and kept the stash entry, while popping on <branch> applied clean.
    • Where the trunk stood is origin/<trunk> while the commits are unpublished. The trunk's reflog answers the same question where the remote is not the reference.

    • **Where they are already pushed, the recovery is asked for rat

Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

  • references/shaping-procedure.md
  • references/worked-example.md
  • scripts/audit-branch-shape.sh

FAQ

Что делает скилл hoc-git-branch?

Conventions for the branches a repository carries — trunks, general branches, and the commits that open and merge them. Use before cutting a branch, merging one back, carrying a change onto one, or discarding one, and before the first edit or commit while `main`, `release/x.x.x`, `dev` or `env` is checked out. What a commit holds belongs to the git commit convention; pushing, to the git push convention.

Как установить скилл hoc-git-branch?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл hoc-git-branch запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить hoc-git-branch с