Contents that posted a long time ago may be obsolete and may not reflect my current opinion.
How to push commits and tags in git using the same command…
近期维护项目,有两个远程仓库,每次发布版本需要执行四条命令。
git push first |
真要命。
经查询发现 Git 似乎暂时没有命令解决此场景,或许是怕引起歧义和混淆吧。
不过有个旁门左道,利用 Git 命令别名实现。
git config --global alias.p '!git push && git push --tags' |
然后就可以用:
git p |
一条命令搞定啦。
参考:https://stackoverflow.com/questions/19404436/git-push-and-git-push-tags-in-the-same-command