Created
January 25, 2016 12:25
-
-
Save koenbollen/cc864db8077ca47a7876 to your computer and use it in GitHub Desktop.
branch will let you quickly create a git branch prefixed with your username
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
# branch will let you quickly create a git branch prefixed with your username | |
function branch() { | |
name=${@:?"mssing argument usage: branch BRANCH NAME"} | |
slug=$(echo "${name}" | tr -s "A-Z_ " "a-z--" | tr -cd "a-z0-9-" ) | |
cmd="git checkout -b ${USER}/${slug}" | |
echo -n "\033[37;1m${cmd}?\033[0m [\033[0;32menter\033[0m/\033[0;31mctrl+c\033[0m] " | |
read || return | |
eval $cmd | |
} |
Author
koenbollen
commented
Jan 25, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment