Last active
April 1, 2019 12:05
-
-
Save Gaafar/55b1b7b8da3f7b4905034bd5e6df3abc to your computer and use it in GitHub Desktop.
shove to branch
This file contains 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
#!/bin/bash | |
# install: | |
# copy this file to /usr/local/bin/shove | |
# sudo chmod +x /usr/local/bin/shove | |
# then use: shove alpha | |
remoteBranch=${1?Please specify origin branch to shove} | |
localBranch=`git symbolic-ref --short -q HEAD` | |
read -p "Force push local branch ($localBranch) => (origin/$remoteBranch). Proceed? (y/n) " -r | |
if [[ $REPLY =~ ^[Yy]$ ]] | |
then | |
git branch -D $remoteBranch | |
git checkout -b $remoteBranch | |
git push -f origin $remoteBranch | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment