I am trying to be able do something like this:
> function gitb(){ git checkout -b $1; alias $1='git checkout $1'; }
> gitb sample
Switched to a new branch 'sample'
> git checkout master
Switched to branch 'master'
> sample
Switched to branch 'sample'
But, the function gitb doesn’t behave as expected because:
> alias sample
alias sample='git checkout $1'
instead of
> alias sample
alias sample='git checkout sample'
Can anybody tell me how to achieve what I am trying to?
Learn the difference between single and double quotes.