Skip to content

Instantly share code, notes, and snippets.

@koenbollen
Created January 25, 2016 12:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koenbollen/cc864db8077ca47a7876 to your computer and use it in GitHub Desktop.
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
# 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
}
@koenbollen
Copy link
Author

screen shot 2016-01-25 at 13 27 34

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment