New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use --force-with-lease instead of --force on git push #11590
Comments
I tried implementing this but failed miserably to keep the tests green. Apparently in the bare checkout (https://github.com/renovatebot/renovate/blob/26.19.1/lib/util/git/index.spec.ts#L71) using Removing I don't know enough about git bare repos yet I guess, I might take another look next week or so. |
It might be easier once I merge and verify #11401 |
Thx, I saw. I'll continue this week :) |
I've assigned this issue to you, so that we - and others - can see you're going to work on the feature. 😉 |
🎉 This issue has been resolved in version 27.22.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
What would you like Renovate to be able to do?
I have renovate running with :rebaseStalePrs to keep branches updated and today I managed to work at a branch the same time as renovate did. Apparently I finished my work before the bot and I was using
--force-with-lease
which was working fine. Then the bot finished it's work too using--force
which overwrote my work. When I was checking the PR I was confused for a good minute and tried to figure out where my changes went.I guess this is pretty rare to happen, but I suggest that renovate uses
--force-with-lease
instead to prevent exactly what I described. In that case the push should be safer and fail if the remote ref is not the expected value (most likely because somebody edited it inbetween). See also https://git-scm.com/docs/git-push#Documentation/git-push.txt---no-force-with-leaseIf you have any ideas on how this should be implemented, please tell us here.
If I'm not mistaken, it should be as simple as replacing
--force
with--force-with-lease
in https://github.com/renovatebot/renovate/blob/26.19.1/lib/util/git/index.ts#L804Is this a feature you are interested in implementing yourself?
Yes
The text was updated successfully, but these errors were encountered: