如何使用refspec将Git标签推送到分支? - How do you push a Git tag to a branch using a refspec?

10/14 11:15
阅读数 20

问题:

I want to force push, for example, my tag 1.0.0 to my remote master branch. 我想强制推送,例如,我的标签1.0.0到我的远程master分支。

I'm now doing the following: 我现在正在做以下事情:

git push production +1.0.0:master

I want to force the push , because all I care about is that the code inside the 1.0.0 tag is pushed to the master branch on the remote repository. 我想强制推送 ,因为我关心的是1.0.0标记内的代码被推送到远程存储库上的master分支。

What am I doing wrong? 我究竟做错了什么?

Update #1 更新#1

When I SSH into my server where my Git repository is and execute git branch -l , I don't see the master branch listed either. 当我通过SSH连接到我的Git存储库所在的服务器并执行git branch -l ,我也看不到列出的master分支。

Update #2 更新#2

After running git tag -l from inside the remote Git repository, I see that master is listed, meaning that when I ran the following: 从远程Git存储库中运行git tag -l后,我看到master已列出,这意味着当我运行以下命令时:

git push production 1.0.0:master

It actually pushed the tag and created a tag named master rather than a new branch . 它实际上推送了标签并创建了一个名为 master的标签,而不是一个新的分支

I want to basically push the contents of the tag 1.0.0 into the master branch of the remote Git repository. 我想基本上将标签1.0.0内容推送到远程Git存储库的master分支。


解决方案:

参考一: https://en.stackoom.com/question/H2Zl
参考二: https://stackoom.com/question/H2Zl
展开阅读全文
git
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部