Created
October 14, 2021 16:16
-
-
Save mpharrigan/95c7c9be795b3f3704f57f0d721dd0ff to your computer and use it in GitHub Desktop.
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
set -e | |
# config: set this to your remote name | |
remote='origin' | |
branch_c='-c' | |
push_f='' | |
while getopts f flag | |
do | |
case "${flag}" in | |
f) branch_c='-C' push_f='-f';; | |
esac | |
done | |
oldname=`git rev-parse --abbrev-ref HEAD` | |
newname=$oldname-`date +%F-%Hh` | |
git branch $branch_c $newname | |
git branch --unset-upstream $newname | |
git push $push_f $remote $newname:$newname -u |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment