pdulvp.fr

`prel attach-issue`: an issue filed from a commit already made has been fixed.

See more details at : https://github.com/pdulvp/prel/issues/11

  • prel attach-issue [<commit>...|--all] files a commit's message as a GitHub

issue -- subject as title, the rest as body, identity trailers stripped --
and replays the commit with #<n> in front of its subject

  • any commit of the branch, not only the last: the commits from it to HEAD

are rebuilt with git commit-tree, keeping author and committer identity and
both dates, the way recommit-last and exclude-from-git already do

  • a subject already numbered, a merge and a commit off the branch are left

alone and said so, so a second run is a no-op

  • gh and a GitHub remote are required here, unlike in the commit hooks: the

issue filed for a rewrite that then fails is kept in
.git/prel-attached-issue and reused rather than left orphaned

prel attach-issue: an issue filed from a commit already made

<sub>2026-10-23-1620-attach-issue.md — 2026-10-23 16:20</sub>

prel issue-from-plans files an issue at commit time, out of docs/plans.
What is missing is the other way round: a commit already made, with a good
message and no issue behind it. prel attach-issue files that message as an
issue and puts its number in front of the subject.

prel attach-issue # HEAD
prel attach-issue 515ed05 # any commit on the branch, not only the last
prel attach-issue --all # every unattached commit ahead of upstream
prel attach-issue 515ed05 -n # dry run

  • the subject is the issue title, the rest of the message its body, with the

trailers (Co-Authored-By:, Committer:, Signed-off-by:, ...) stripped --
they say who committed, which the commit already says;

  • the commit is then replayed with #<n> in front of its subject.

A commit that is not the last one is replayed the way prel exclude-from-git
and prel recommit-last already replay one: git commit-tree over the
commits from the target to HEAD, each rebuilt onto the rewrite of its
parent, author and committer identity and both dates kept. Only the message
changes. Commits before the target keep their hash; those after it get new
ones, and a branch already pushed needs a force push -- the same bargain as
the two commands above.

Steps

  • [x] scripts/attach-issue.sh -- the command, shortcut attach
  • _ai_issue_title / _ai_issue_body: subject, body without trailers
  • targets: HEAD by default, any commit-ish, several of them, --all

for the commits ahead of @{upstream}

  • skipped and said so: a subject already carrying #<n>, a merge, a

commit that is not an ancestor of HEAD

  • hard errors (the issue is the whole point here, unlike in the hook):

no gh, no GitHub remote, a rebase or merge in progress

  • .git/prel-attached-issue remembers an issue filed for a rewrite that

then failed, so a retry reuses it rather than filing a second one

  • -n / --dry-run prints title, body and the planned rewrite
  • [x] README.md -- a ### prel attach-issue (or attach) section after

prel issue-from-plans, and the command list at the top of ## Commands

  • [x] tried on a scratch repository with a stub gh: a middle commit

attached and its descendants replayed, hashes before it unchanged, author
and committer identity and both dates kept, trailers out of the issue
body and still in the commit, --all, a reused issue out of the cache, a
second run a no-op, a merge and a non-ancestor refused, detached HEAD
refused. Dry runs on prel and win32 themselves; no issue filed on a real
repository, the pushed history being the user's call

<sub>Filed by prel from the completed plans at commit time.</sub>