Skip to content

Instantly share code, notes, and snippets.

@DBarthe
Created June 22, 2017 10:21
Show Gist options
  • Save DBarthe/8f52f14e6abd4d5935f915778f6b58d4 to your computer and use it in GitHub Desktop.
Save DBarthe/8f52f14e6abd4d5935f915778f6b58d4 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
remote=${1:-origin}
branch=${2:-master}
commit=$(git log -1 | head -n 1 | cut -d' ' -f 2)
git push ${remote} +${commit}^:${branch}
git reset HEAD^ --hard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment