feat(git): safely force push with lease #11754
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes:
Switches from
--force
to--force-with-lease
forgit push
commands to push safer by avoiding to overwrite remote changes.Context:
Closes #11590
Documentation
How I've tested my work
I have verified these changes via:
Details:
I tried to add a new test that would trigger the force-push error and verify the new behaviour but failed. It always force-pushed successfully in the tests, but manually (by switching in to the git repo dirs that were used for testing) it correctly failed, I unfortunately don't know why. But triggering the force-push error will be pretty rare anyways I guess.
Manually verified via
WARN: Error updating branch
and do nothing