我知道git push --tags
是一个与普通旧git push
分开的操做的缘由。 推进标签应该是一个有意识的选择,由于你不想意外推进标签。 不要紧。 但有没有办法将二者结合在一块儿? (除了git push && git push --tags
。) git
从git 2.4.1开始 ,你能够作到 fetch
git config --global push.followTags true
若是设置为true,则默认启用--follow-tags选项。 您能够经过指定--no-follow-tags在推送时覆盖此配置。 atom
从git 1.8.3(2013年4月22日)开始 , 您再也不须要执行2个命令来推送分支,而后推送标签 : url
新的“
--follow-tags
”选项告诉“git push
” 在推出分支时推送相关的注释标签 。 spa
您如今能够在推送新提交时尝试: .net
git push --follow-tags
这不会推送全部本地标签,只有经过git push
提交引用的标签。 命令行
Git 2.4.1 +(2015年第2季度)将引入选项push.followTags
:请参阅“ 如何制做” git push
“在分支中包含标签? ”。 code
核选项将是git push --mirror
,它将在refs/
下推送全部引用。 rem
您还可使用当前分支提交仅推送一个标记: get
git push origin : v1.0.0
您能够将--tags
选项与--tags
结合使用,例如:
git push origin --tags :
(由于--tags
意味着: 除了在命令行中明确列出的 --tags
以外 , 还会推送 refs/tags
下的全部引用)
您还有此条目“ 使用单个”推送分支和标签“git push”调用 “
一个方便的提示刚刚被ZoltánFüzesi发布到Git邮件列表中 :
我使用
.git/config
来解决这个问题:
[remote "origin"] url = ... fetch = +refs/heads/*:refs/remotes/origin/* push = +refs/heads/* push = +refs/tags/*
添加这些行后,
git push origin
将上传全部分支和标签。 若是您只想上传其中一些,能够枚举它们。尚未尝试过,但看起来它可能会有用,直到同时推送分支和标签的其余方式添加到git push。
另外一方面,我不介意打字:
$ git push && git push --tags
请注意 , Aseem Kishore 评论道
push = +refs/heads/*
将强制推送全部分支 。
刚才这就是我,因此我是。
RenéScheibe添加了这个有趣的评论 :
--follow-tags
参数具备误导性,由于只考虑.git/refs/tags
下的.git/refs/tags
。
若是运行git gc
,标签将从.git/refs/tags
到.git/packed-refs
。 以后git push --follow-tags ...
再也不按预期工做了。
也许这有助于某人:
1. git commit -a -m "msg" 2. git tag 0.1.0 // creates a new tag locally 3. git push origin tag 0.1.0 // pushes the tag & the code in the remote repo
Git GUI有一个PUSH按钮 - 原谅双关语,它打开的对话框有一个标签复选框。
我从命令行推了一个分支,没有标签,而后再次尝试使用上面描述的--follow-tags
选项推进分支。 该选项被描述为如下带注释的标签。 个人标签是简单的标签。
我修复了一些东西,用修复标记了提交,(因此同事能够选择修复),而后更改了软件版本号并标记了我建立的版本(所以同事能够克隆该版本)。
Git回来讲一切都是最新的。 它没有发送标签! 也许是由于标签没有注释。 也许是由于分支上没有什么新东西。
当我使用Git GUI进行相似的推送时,标签被发送了。
目前,我将使用Git GUI将个人更改推送到个人遥控器,而不是使用命令行和--follow-tags
。
@since Git 2.4
git push --atomic origin <branch name> <tag>