Skip to content

Recipe: Git Workflows

yaku works well with git output via stdin pipes. Here are common workflows for multilingual teams.

Terminal window
# Last 10 commits
git log --oneline -10 | yaku --to en
# With full messages
git log --format="%h %s" -10 | yaku --to en

Translate the human-readable parts of a diff while preserving diff markers:

Terminal window
git diff HEAD~1 | yaku --to en

yaku translates the changed content. Diff markers (+, -, @@) and file paths are preserved by the LLM’s built-in rules.

Translate a commit message before committing

Section titled “Translate a commit message before committing”

Write your commit message in your native language, then translate or polish it to English:

Terminal window
# Write in your language, translate to English
echo "修正了登入頁面的驗證錯誤" | yaku --to en
# Fixed the validation error on the login page
# Or use polish mode for rough English drafts
echo "fix the bug where user cant login when password has special chars" | \
yaku --mode polish --to en
# Fix the bug where users cannot log in when their password contains special characters

Use the GitHub CLI to fetch and translate PR descriptions:

Terminal window
# Translate a PR body
gh pr view 42 --json body -q .body | yaku --to en
# Translate PR comments
gh api repos/owner/repo/pulls/42/comments \
--jq '.[].body' | yaku --to en
Terminal window
# Translate the latest release notes
gh release view --json body -q .body | yaku --to en
  • Use --context for git output. Adding --context "git commit messages" helps the LLM understand the format.
  • Pipe through head for large diffs. Avoid sending enormous diffs: git diff | head -200 | yaku --to en.
  • Review before committing. Always review translated commit messages before using them in your git history.