Created
October 25, 2014 22:38
-
-
Save krazylegz/0a49ddee5ce0baf2d5c6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| repush () { | |
| if [ -z "$1" ] | |
| then | |
| branch=$(git rev-parse --abbrev-ref HEAD) | |
| else | |
| branch=$1 | |
| fi | |
| if [[ $branch != 'master' ]] | |
| then | |
| echo "Repushing $branch" | |
| original_branch=$(git rev-parse --abbrev-ref HEAD) | |
| git checkout $branch | |
| git commit --amend -m "$(git log -1 --oneline | cut -d " " -f 2-)" | |
| git push -f origin $(git rev-parse --abbrev-ref HEAD) | |
| git checkout $original_branch | |
| echo "Repushed $branch." | |
| return 0 | |
| else | |
| echo "Refusing to repush master." | |
| return 1 | |
| fi | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment