Created
July 31, 2026 00:40
-
-
Save nemith/a3e32ec89bb5cb1041bb1bead073aa30 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ❯ jj config get aliases.submit | |
| ["util", "exec", "--", "bash", "-c", ''' | |
| set -euo pipefail | |
| # Stack = non-empty, described commits between trunk and the target (defaults to @). | |
| target="${1:-@}" | |
| revset="trunk()..$target & ~empty() & ~description(exact:\"\")" | |
| # Auto-create push bookmarks (git_push_bookmark template) and push the whole stack. | |
| jj git push -c "$revset" | |
| # Collect bookmark names oldest-first, the order gh stack link expects (base -> top). | |
| bookmarks=$(jj log -r "$revset" --reversed --no-graph \ | |
| -T 'local_bookmarks.map(|b| b.name()).join("\n") ++ "\n"' | grep -v '^$') | |
| if [ -z "$bookmarks" ]; then | |
| echo "no bookmarks to submit in: $revset" >&2 | |
| exit 1 | |
| fi | |
| # Create (draft) PRs and chain their bases; existing PRs are reused. | |
| gh stack link $bookmarks | |
| # Sync each PR's title/body from its commit description (covers create + update). | |
| for b in $bookmarks; do | |
| desc=$(jj log -r "$b" --no-graph -T description) | |
| title=$(printf '%s\n' "$desc" | head -n1) | |
| body=$(printf '%s\n' "$desc" | tail -n +2 | sed '/./,$!d') | |
| if [ -n "$body" ]; then | |
| gh pr edit "$b" --title "$title" --body "$body" | |
| else | |
| gh pr edit "$b" --title "$title" | |
| fi | |
| done | |
| ''', "submit"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment