Skip to content

Instantly share code, notes, and snippets.

@CervEdin
Last active December 26, 2021 08:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CervEdin/2e72388c3f7d9b30d961ec3b64d08761 to your computer and use it in GitHub Desktop.
Save CervEdin/2e72388c3f7d9b30d961ec3b64d08761 to your computer and use it in GitHub Desktop.
Interactive force push
#!/bin/bash
git log --oneline --graph @{upstream}...HEAD
git diff @{upstream} HEAD
read -p "Push (with force)?" -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
git push --force-with-lease
exit $?
fi
exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment