【发布时间】:2013-11-14 06:13:29
【问题描述】:
现在我这样做:
git commit -a -m "comment"
然后(到 bitbucket.org)
git push
然后(通过 ftp 托管)
git ftp push
我想自动运行这些命令:
git fix "comment"
左右:
gitfix "comment"
【问题讨论】:
现在我这样做:
git commit -a -m "comment"
然后(到 bitbucket.org)
git push
然后(通过 ftp 托管)
git ftp push
我想自动运行这些命令:
git fix "comment"
左右:
gitfix "comment"
【问题讨论】:
创建一个 bash 函数:
gitfix() {
git commit -a -m "$1" && git push && git ftp push
}
并将其放入您的 ~/.bashrc 文件中,这样您就可以从终端以 gitfix "some commit comment" 的身份执行它
更新:将命令与&&连接起来,因此,如果失败,将不会执行剩余的命令。感谢 burper 的更新。
【讨论】:
&&连接起来,这样,如果失败,剩下的命令将不会被执行。