cd /news/developer-tools/small-git-tools-to-take-authorship-f… · home topics developer-tools article
[ARTICLE · art-60787] src=gist.github.com ↗ pub= topic=developer-tools verified=true sentiment=· neutral

Small git tools to take authorship from LLM work

A developer created a Git tool called git_reauthor.sh that rewrites commit authorship and Co-Authored-By trailers for a range of commits. The script can replace author/committer identity, strip or replace Co-Authored-By lines, and is intended to help developers take authorship credit for work originally generated by large language models.

read5 min views1 publishedJul 15, 2026

| #!/usr/bin/env bash | | | | | | | | | | | | | | | | | | | | | | | | set -euo pipefail | | | | if [ "$#" -lt 1 ] || [ "$#" -gt 3 ]; then | | echo "usage: $(basename "$0") <back_until_sha_inclusive> <committer_name_email> <coauthored_by_name_email>" >&2 | | echo " (args 2 and 3 optional; omit arg 3 to strip Co-Authored-By lines," >&2 | | echo " omit arg 2 to also fall back to the current git config identity)" >&2 | | exit 2 | | fi | | | | SINCE="$1" | | IDENT="${2:-}" | | COAUTHOR="${3:-}" | | | | | if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then | | echo "error: not inside a git work tree" >&2 | | exit 1 | | fi | | | | if ! git rev-parse --verify --quiet "${SINCE}^{commit}" >/dev/null; then | | echo "error: '$SINCE' is not a valid commit" >&2 | | exit 1 | | fi | | | | | | if [ -n "$IDENT" ]; then | | case "$IDENT" in | | "<"">") : ;; | | ) echo "error: committer identity must look like 'Name <email>', got '$IDENT'" >&2; exit 1 ;; | | esac | | RA_NAME="$(printf '%s' "$IDENT" | sed -E 's/[[:space:]]<[^>]>[[:space:]]$//')" | | RA_EMAIL="$(printf '%s' "$IDENT" | sed -E 's/[1]<([^>])>.$/\1/')" | | else | | RA_NAME="$(git config user.name || true)" | | RA_EMAIL="$(git config user.email || true)" | | if [ -z "$RA_NAME" ] || [ -z "$RA_EMAIL" ]; then | | echo "error: no identity given and git config user.name/user.email is unset" >&2 | | exit 1 | | fi | | fi | | | | if [ -n "$COAUTHOR" ]; then | | case "$COAUTHOR" in | | "<"">"*) : ;; | | ) echo "error: co-author must look like 'Name <email>', got '$COAUTHOR'" >&2; exit 1 ;; | | esac | | fi | | | | | | if git rev-parse --verify --quiet "${SINCE}^{commit}^" >/dev/null; then | | RANGE="${SINCE}~1..HEAD" | | else | | RANGE="HEAD" | | fi | | | | | | | | AWK_PROG="$(mktemp "${TMPDIR:-/tmp}/reauthor.XXXXXX")" | | trap 'rm -f "$AWK_PROG"' EXIT | | cat > "$AWK_PROG" <<'AWK' | | { buf[NR] = $0 } | | END { | | m = 0 | | for (i = 1; i <= NR; i++) { | | if (tolower(buf[i]) ~ /^co-authored-by:/) continue | | out[++m] = buf[i] | | } | | while (m > 0 && out[m] ~ /[2]$/) m-- # trim trailing blanks | | for (i = 1; i <= m; i++) print out[i] | | if (ca != "") { | | if (m > 0 && out[m] ~ /[3]+:[ \t]/) { # last line already a trailer | | print "Co-Authored-By: " ca | | } else { | | if (m > 0) print "" # blank line before trailer | | print "Co-Authored-By: " ca | | } | | } | | } | | AWK | | | | | export RA_NAME RA_EMAIL COAUTHOR | | | | ENV_FILTER=' | | export GIT_AUTHOR_NAME="$RA_NAME" | | export GIT_AUTHOR_EMAIL="$RA_EMAIL" | | export GIT_COMMITTER_NAME="$RA_NAME" | | export GIT_COMMITTER_EMAIL="$RA_EMAIL" | | ' | | MSG_FILTER="awk -v ca="$COAUTHOR" -f "$AWK_PROG"" | | | | if [ -n "$COAUTHOR" ]; then | | echo "Reauthoring $RANGE as '$RA_NAME <$RA_EMAIL>', co-author -> '$COAUTHOR'" | | else | | echo "Reauthoring $RANGE as '$RA_NAME <$RA_EMAIL>', stripping Co-Authored-By lines" | | fi | | | | FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch -f \ | | --env-filter "$ENV_FILTER" \ | | --msg-filter "$MSG_FILTER" \ | | -- $RANGE | | | | echo | | echo "Done. Backup ref kept at refs/original/. Undo with:" | | echo " git reset --hard refs/original/refs/heads/$(git rev-parse --abbrev-ref HEAD)" |


  1. ^< ↩︎

  2. \t ↩︎

  3. A-Za-z0-9- ↩︎

── more in #developer-tools 4 stories · sorted by recency
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/small-git-tools-to-t…] indexed:0 read:5min 2026-07-15 ·