Skip to content

Instantly share code, notes, and snippets.

@jakobhellermann
Last active July 22, 2025 10:55
Show Gist options
  • Select an option

  • Save jakobhellermann/bfeb9f449d8a3195edda5348a63293b5 to your computer and use it in GitHub Desktop.

Select an option

Save jakobhellermann/bfeb9f449d8a3195edda5348a63293b5 to your computer and use it in GitHub Desktop.
jj team configuration
{
"medrano": "Caroline Medrano <medrano@company.com>",
"doe": "John Doe <doe@company.com>"
}
[custom]
coauthors = ["John Doe <doe@company.com>"]
[aliases]
team = ['util', 'exec', 'sh', '--', '-c', '''
set -euo pipefail
coauthorsfile="$(dirname $(jj config path --user))/coauthors.json"
if [[ $# -eq 0 ]]; then
jj config list --color never | rg 'custom.coauthors' | head -n1 | cut -d= -f2 | jq -r .[]
exit 0
fi
if [[ "$1" == "--help" || "$1" == "-h" ]]; then
echo "jj team alias1 alias2"
echo "jj team # show current"
echo "jj team disable"
exit 0
fi
if [[ "$1" == "list" ]]; then
jq '.' "$coauthorsfile"
exit 0
fi
if [[ "$1" == "disable" ]]; then
jj config set --user custom.coauthors "[]"
exit 0
fi
coauthors=$(jq --compact-output '. as $coauthors | $ARGS.positional | map($coauthors[.])' "$coauthorsfile" --args "$@")
jj config set --user custom.coauthors "$coauthors"
''', '']
[template-aliases]
default_commit_description = '''
surround("\n\n", "\n", config("custom.coauthors").as_string_list().map(|author| "Co-Authored-By: " ++ author).join("\n"))
'''
jj team doe medrano # configure active coauthors
jj commit # this will add `Co-Authored-By: ` lines for every coauthor
jj team # show current config
jj team list # show all coauthors
jj team disable # remove all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment