下面是我的自定义gitp命令,它非常有效(使用psuedo代码)。我想通过让脚本自动索引并签出到新分支来添加脚本。 希望有一个命令行的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 }