Skip to content

Instantly share code, notes, and snippets.

@tadd
Last active November 11, 2023 05:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tadd/c504b2f5c8f07dd717726c049e0e55f1 to your computer and use it in GitHub Desktop.
Save tadd/c504b2f5c8f07dd717726c049e0e55f1 to your computer and use it in GitHub Desktop.
Force not to use `git push -f` but `--force-with-lease`
#!/bin/bash -eu
argv="$(sed -E 's/(^| )-f\b/\1--force-with-lease/g' <<<$@)"
exec git push ${argv}
@tadd
Copy link
Author

tadd commented Dec 18, 2022

Pro Tips™

Acknowledgments

This gist is inspired by @onk's blog entry. Thanks a lot!

Footnotes

  1. Your safety is not that much of my priority, though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment