#!/bin/bash
function git_start_feature() {
story_title=$1
story_title=${story_title,,} # downcase string
story_title=${story_title// /-} # replace spaces by dashes
story_title=${story_title//\//-} # replace slashes by dashes
story_title=${story_title//[.,:]/} # remove punctuation characters
git checkout -b feature/$story_title
}
Being on the develop branch, you can just say
$ git_start_feature "this is my new nice feature: that I'm working on with slashes/and .dots"
and a new branch will be created starting from develop, as:
feature/this-is-my-new-nice-feature-that-im-working-on-with-slashes-and-dots
Yeah, it's lighter @TheNaoX.
@daniel-g pretty nice! I like it, so trick there is to prefix the name of the file that contains the script with "git-", and load it in the bash session.
Also they can be taken into account by git by encapsulating the script in a code function name with the prefix "git", I found doc talking about that here: https://coderwall.com/p/wjuoag