[alias]
    # Привязать номер задачи к текущей ветке
    set-issue = "!f() { \
        if [ -z \"$1\" ]; then \
            echo 'Usage: git set-issue <issue-number>'; \
            exit 1; \
        fi; \
        branch=$(git rev-parse --abbrev-ref HEAD); \
        git config branch.\"$branch\".issue \"$1\"; \
        echo \"Set issue $1 for branch $branch\"; \
    }; f"

    # Создать ветку и сразу привязать к ней номер задачи
    new-branch = "!f() { \
        if [ $# -lt 2 ]; then \
            echo 'Usage: git new-branch <branch-name> <issue-number>'; \
            exit 1; \
        fi; \
        branch=\"$1\"; shift; \
        issue=\"$1\"; \
        git checkout -b \"$branch\" && \
        git set-issue \"$issue\"; \
    }; f"

    # Показать номер задачи для текущей ветки
    issue = "!f() { \
        branch=$(git rev-parse --abbrev-ref HEAD); \
        issue=$(git config branch.\"$branch\".issue || true); \
        if [ -z \"$issue\" ]; then \
            echo \"No issue set for branch $branch\"; \
            exit 1; \
        fi; \
        echo \"$issue\"; \
    }; f"

    # Коммит: без аргументов откроет редактор, с аргументами — создаст сообщение [TAG] MSG. OMP<ISSUE>
    cmt = "!f() { \
        branch=$(git rev-parse --abbrev-ref HEAD); \
        issue=$(git config branch.\"$branch\".issue || true); \
        if [ -z \"$issue\" ]; then \
            echo \"No issue set for branch $branch\"; \
            echo \"Use: git set-issue <issue-number>\"; \
            exit 1; \
        fi; \
        if [ $# -eq 0 ]; then \
            tmpfile=$(mktemp /tmp/git-commit-template.XXXXXX); \
            echo \"[TAG] message. OMP#$issue\" > \"$tmpfile\"; \
            git commit -t \"$tmpfile\"; \
            rm -f \"$tmpfile\"; \
        else \
            tag=\"$1\"; shift; \
            msg=\"$*\"; \
            git commit -m \"[$tag] $msg. OMP#$issue\"; \
        fi; \
    }; f"