Skip to content

Instantly share code, notes, and snippets.

@calebhaye
Last active December 14, 2017 18:58
Show Gist options
  • Save calebhaye/68ee7ab9253abacb6c028be23db462e5 to your computer and use it in GitHub Desktop.
Save calebhaye/68ee7ab9253abacb6c028be23db462e5 to your computer and use it in GitHub Desktop.
Ruby bash script to create a git branch from string STDIN
#!/usr/bin/env ruby -w
name = ARGV[0]
slug = name.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '')
system("git checkout -b #{slug}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment