You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
@dependabot recreate does not actually recreate the commit #4652
I had a dependabot PR that I was munging around with trying to see what additional changes were required to get CI to pass.
However, I accidentally fat-fingered some git commands and dropped the original commit from Dependabot, both locally and on the remote.
So I did a @dependabot recreate since the description of that command says:
@dependabot recreate will recreate this PR, overwriting any edits that have been made to it
However, when Dependabot recreated the PR, it didn't reset the commit title or description. It merely reset the code changes of the commit.
I think this is a bug because recreating the PR should recreate the commit metadata, title, description, etc. Honestly, that's a big part of the usefulness of Dependabot, is the detailed commit messages listing what changed and links to more info. Very useful for later git blame spelunking when trying to figure out what may have caused a problem.
Notes:
No Job ID that is publicly accessable since this is a recreate of a specific PR.
commit hash that was force-pushed by Dependabot is f8bc0a02b4678cae09505a27eb8805b6ca1739ed
It was on a go-based repo. However, I suspect this is generic dependabot behavior that would repro for any language.
In this case the original commit was lost so it probably used the description from another commit in the PR?
Yep, that's exactly what happened.
And that code section is what needs updating. But before opening a PR to fix, wanted to make sure we were all in agreement on what the desired behavior here should be.
I do think the ideal behavior here would have been to have the proper message on the commit. However, I'm seeing that in the spot that we are calling the PR updater internally we don't have the metadata available... We'd need to track down why that is the case and adjust it first.
In this case the original commit was lost so it probably used the description from another commit in the PR?
Yep, that's exactly what happened.
And that code section is what needs updating. But before opening a PR to fix, wanted to make sure we were all in agreement on what the desired behavior here should be.
In what scenarios do y'all envision @dependabot would re-use a commit message from a different pull request?
My Ruby fu is weak. Unless Ruby does something surprising with this bit of code, tho, I think any commit commit_being_updated returns should be from the same pull request where @dependabot recreate was run:
As of #5913 we'll now fall back to using the PR title as the commit message if the old commit has been lost. This is an interim solution until we have the capability to recreate the commit message for PR updates (context)
I ran into something similar today. Had an action that force-pushed something onto the original Dependabot commit (a version update of the project). However, whenever I tried a @dependabot recreate afterwards it would be incapable of creating a proper commit description and just write Dependabot couldn't find the original pull request head commit, $SHA.
I think this is really unfortunate, because the description of @dependabot recreate really sounds like the Dependabot PR will be recreated from scratch. Having this rely on some old commit message that could vanish from the repo is quite surprising.
Reacted by Marco Spengler, Matthieu Masztalir, Louis-Philippe Cloutier, Joonas Krohn and Björn Büttner
It would really be better IMO if recreate did what it sounds like: close the current PR and create a new PR from scratch targeting the same dependency (at whatever version would be appropriate if it were running an update and there were no existing PR for this dependency). This has been requested elsewhere.
My organization encountered a curious case today. We have a repo with branch protection which prohibits pushing unsigned commits. We needed to import (think git subtree) historical commits from another repo, long predating the requirement to sign commits, so the PR doing this was merged while temporarily disabling the rule, which was then immediately enforced again. Fine so far. But there were a number of DB PRs open previously which we would like to update to the current base branch to rerun CI. @dependabot rebase cannot work in this case because it would involve (force-)pushing to the DB PR branch; this branch is in the origin repo, not a fork, and the rule sees that the delta from the previous branch head to the new branch head “includes” a bunch of unsigned commits, which it thus rejects. But @dependabot recreate will not work either, for the same reason. And if we simply close the doomed PR, DB will decline to open a new one for that version, so if the dependency component does not change very often, we would need to manually refile the PR.
Reacted by Yeikel Santana, Peter Nybergh, Diego Verbrugghe and Chad Paine
Activity
mctofu commentedon Jan 26, 2022
I think this happens because a recreate triggers an update of the PR and we currently expect that we can re-use the message from the previous commit: https://github.com/dependabot/dependabot-core/blob/main/common/lib/dependabot/pull_request_updater/github.rb#L186
In this case the original commit was lost so it probably used the description from another commit in the PR?
jeffwidman commentedon Jan 26, 2022
Yep, that's exactly what happened.
And that code section is what needs updating. But before opening a PR to fix, wanted to make sure we were all in agreement on what the desired behavior here should be.
mctofu commentedon Jan 27, 2022
I do think the ideal behavior here would have been to have the proper message on the commit. However, I'm seeing that in the spot that we are calling the PR updater internally we don't have the metadata available... We'd need to track down why that is the case and adjust it first.
solvaholic commentedon Oct 3, 2022
In what scenarios do y'all envision @dependabot would re-use a commit message from a different pull request?
My Ruby fu is weak. Unless Ruby does something surprising with this bit of code, tho, I think any commit
commit_being_updatedreturns should be from the same pull request where@dependabot recreatewas run:bdragon commentedon Oct 20, 2022
As of #5913 we'll now fall back to using the PR title as the commit message if the old commit has been lost. This is an interim solution until we have the capability to recreate the commit message for PR updates (context)
codecholeric commentedon Feb 26, 2024
I ran into something similar today. Had an action that force-pushed something onto the original Dependabot commit (a version update of the project). However, whenever I tried a
@dependabot recreateafterwards it would be incapable of creating a proper commit description and just writeDependabot couldn't find the original pull request head commit, $SHA.I think this is really unfortunate, because the description of
@dependabot recreatereally sounds like the Dependabot PR will be recreated from scratch. Having this rely on some old commit message that could vanish from the repo is quite surprising.jglick commentedon Oct 30, 2025
It would really be better IMO if
recreatedid what it sounds like: close the current PR and create a new PR from scratch targeting the same dependency (at whatever version would be appropriate if it were running an update and there were no existing PR for this dependency). This has been requested elsewhere.My organization encountered a curious case today. We have a repo with branch protection which prohibits pushing unsigned commits. We needed to import (think
git subtree) historical commits from another repo, long predating the requirement to sign commits, so the PR doing this was merged while temporarily disabling the rule, which was then immediately enforced again. Fine so far. But there were a number of DB PRs open previously which we would like to update to the current base branch to rerun CI.@dependabot rebasecannot work in this case because it would involve (force-)pushing to the DB PR branch; this branch is in the origin repo, not a fork, and the rule sees that the delta from the previous branch head to the new branch head “includes” a bunch of unsigned commits, which it thus rejects. But@dependabot recreatewill not work either, for the same reason. And if we simply close the doomed PR, DB will decline to open a new one for that version, so if the dependency component does not change very often, we would need to manually refile the PR.yeikel commentedon Nov 21, 2025
I noticed this today, and I also thought it was a bug #13606
I also think that Dependabot should simply close the pull request and create a new pull request with the updated information
For people who squash and merge like my team, this unfortunate defect can cause considerable confusion
v-kbukum1 commentedon Apr 24, 2026
The fix applied. One the fix PR is #14808.