在 bash_profile 中自定义 git 命令以自动索引到下一个分支
customizing git commands in bash_profile to auto index to next branch
下面是我的自定义 gitp 命令,效果很好(使用伪代码)。我想通过让它自动自动索引并签出到新分支来添加到脚本中。
希望有命令行高手bash 能弄明白! :)
previous_branch_num = 0;
gitp() {
git add -A &&
git commit -m "${1?'Missing commit message'}" &&
git push
git checkout -b "v{++previous_branch_num}" //<--psuedo code
}
简单:
#!/bin/bash
previous_branch_num=0
gitp() {
git add -A &&
git commit -m "${1?'Missing commit message'}" &&
git push
git checkout -b "v$((++previous_branch_num))" # <-- real code
}
下面是我的自定义 gitp 命令,效果很好(使用伪代码)。我想通过让它自动自动索引并签出到新分支来添加到脚本中。 希望有命令行高手bash 能弄明白! :)
previous_branch_num = 0;
gitp() {
git add -A &&
git commit -m "${1?'Missing commit message'}" &&
git push
git checkout -b "v{++previous_branch_num}" //<--psuedo code
}
简单:
#!/bin/bash
previous_branch_num=0
gitp() {
git add -A &&
git commit -m "${1?'Missing commit message'}" &&
git push
git checkout -b "v$((++previous_branch_num))" # <-- real code
}