我试图能够做这样的事情:
> 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'
但是,函数 gitb 的行为不符合预期,因为:
> alias sample
alias sample='git checkout $1'
代替
> alias sample
alias sample='git checkout sample'
谁能告诉我如何实现我想要的目标?