A revert has no rule, its default message does not follow Message format, and git blame stops at it
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 55/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- git, javascript, shell
- Domain
- devtools, documentation
Research direction
Read CONTRIBUTING.md, the commit skill, and tools/trace-decision/collect-lib.mjs, especially findReferences; first check #49 for the merge strategy decision. Update the revert guidance and trace behavior described in the proposal, including tests for following the reverted commit hash. Done means revert messages follow Message format, the commit skill covers reverting PRs and merges, and trace-decision follows revert references.
Written by the indexing model from the issue text.
Description
Problem to solve
CONTRIBUTING.md has no rule for a revert. A revert overturns a decision, but the tools make a revert commit that the rules do not accept, and the history after a revert is harder to trace.
Tests with Git 2.47.1 in temporary repos:
- The message.
git revertwritesRevert "<subject>"andThis reverts commit <hash>.. The subject has no type, the body has noWhy, and nothing givesSupersedes:, which Message format requires when a commit overturns a decision. The Revert button of a merged PR on GitHub makes a commit with the same default message. CI does not check commit messages, so only thecommitskill or a review can find it. - The trace. A file was deleted and, later, a
git revertof the deletion restored it.git blameshowed the revert commit for each line, also with-C -C.git log --follow -- <path>showed the complete history: the commit that added the file, the deletion and the revert. The script oftrace-decisionstarts fromgit blame, so it stops at the revert commit. It follows references to issues and PRs in commit messages, but not the commit hash inThis reverts commit <hash>. - A merge commit. This repo merges each PR with a merge commit.
git revert <merge>fails with "is a merge but no -m option was given".git revert -m 1 <merge>reverts the PR.- After that revert, a new merge of the same branch brought back nothing. Git reported that the branch was already merged. Only a revert of the revert brought the change back.
A deletion alone is traceable. git log -- <path> shows the history of a deleted path, and git log --diff-filter=D --name-only finds deletions when the path is not known. The commit that deletes the file gives the reason in Why.
Proposal
- Add a rule to Commits or Message format in
CONTRIBUTING.md: a revert is a decision, and its message follows Message format.- The subject has the type of the change, for example
docs: restore the setup guide, notRevert "…". Whygives the reason for the revert.Supersedes:names the reverted decision by its subject.- The body keeps the line
This reverts commit <hash>.. The reverted commit is inmain, so its hash does not change.
- The subject has the type of the change, for example
- Give the steps for a revert in the
commitskill:git revert --no-commit <commit>, then a commit with the message above. For a merge commit,git revert --no-commit -m 1 <merge>. To bring a reverted PR back, revert the revert. A new merge of the old branch does not bring it back. - Change the script of
trace-decision: when a commit message hasThis reverts commit <hash>., read that commit too. Then a line thatgit blamegives to a revert commit leads to the reverted decision.
If #49 chooses squash merge, item 3 of the Problem and the -m 1 step go away: each PR is one normal commit in main, and a revert of it is a normal revert.
Version
c3185e8
More information
- Message format and
Supersedes:inCONTRIBUTING.md. tools/trace-decision/collect-lib.mjs:findReferencesfinds issue and PR references only.- #51 proposes that mechanical steps go into scripts with tests, as item 3 does for the trace.
- Dominant language
- Shell
- Stars
- 1
- Forks
- 0
- Avg merge
- 6h 59m
- Merged PRs (30d)
- 26
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from c-w-z/commit-decision-record
-
type/documentation
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
c-w-z/commit-decision-record#90 · 1 comment ·
Maintainers usually reply within 1 day
-
type/documentation
Difficulty 1/5 1-3 hours Newbie friendliness 90/100
c-w-z/commit-decision-record#85 ·
Maintainers usually reply within 1 day
-
type/documentation
Difficulty 1/5 1-3 hours Newbie friendliness 86/100
c-w-z/commit-decision-record#84 ·
Maintainers usually reply within 1 day
-
type/feature
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
c-w-z/commit-decision-record#35 · 1 comment ·
Maintainers usually reply within 1 day
-
good first issue type/documentation
Difficulty 1/5 1-3 hours Newbie friendliness 95/100
c-w-z/commit-decision-record#33 ·
Maintainers usually reply within 1 day
All issues in c-w-z/commit-decision-record
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
omacom/omarchy#21286 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ChurchCRM/docs.churchcrm.io#328 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
melodic-software/claude-code-plugins#20573 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
bmaltais/StartDrive#17 ·