我想创建一个别名,如下所示
gc this is a test message转换为git commit -m "this is a test message".
我怎样才能做到这一点?我希望在我的bashrc中.
bash alias定义不带参数.
尝试在.bashrc中使用bash函数:
function gc () {
git commit -m "$*"
}
Run Code Online (Sandbox Code Playgroud)
我的.bashrc中有这些别名:
alias ga='git add'
alias gp='git push'
alias gl='git log'
alias gs='git status'
alias gd='git diff'
alias gdc='git diff --cached'
alias gm='git commit -m'
alias gma='git commit -am'
alias gb='git branch'
alias gc='git checkout'
alias gra='git remote add'
alias grr='git remote rm'
alias gpu='git pull'
alias gcl='git clone'
Run Code Online (Sandbox Code Playgroud)
我通常承诺 gm "msg"
| 归档时间: |
|
| 查看次数: |
2446 次 |
| 最近记录: |