简体   繁体   English

上游git标签未显示在分叉存储库中

[英]Upstream git tag is not showing in forked repository

I have the 1.11.57 tag in the upstream which i pushed with master branch code. 我在上游有1.11.57标签,我用主分支代码推送。 I am using bitbucket and git bash 我正在使用bitbucket和git bash

在此输入图像描述

I forked above repository and locally use the fork repository as my local master branch. 我在存储库之上分叉并在本地使用fork存储库作为我的本地主分支。 But in my forked repository the 1.11.57 tag is not showing. 但是在我的分叉存储库中,没有显示1.11.57标记。

在此输入图像描述

I check the repository sync also having no problem. 我检查存储库同步也没有问题。 What is the cause of this and how to get the upstream tag to my fork and then to my local too. 造成这种情况的原因是什么以及如何将上游标签放到我的叉子上然后再转到我的本地。

Make sure you has push all tags from your first cloned repo. 确保已从第一个克隆仓库中推送所有标签
With SourceTree: check the "Push all tags" box on the "Push" dialog box. 使用SourceTree:选中“推送”对话框中的“推送所有标签”框。

Only then forking would reflect the new tags. 只有这样才能反映新的标签。

Since you have already forked, add the original repo as a remote, and fetch the tags: 由于您已经分叉,请将原始仓库添加为远程仓库,然后获取标记:

cd /path/to/fork/clone
git remote add upstream url/original/repo
git fetch --tags upstream
Push the tag from my local to my master branch
git push -f --tags origin master

(You can also add the new remote with SourceTree ) (您也可以使用SourceTree添加新的遥控器
(And you have the "Fetch and store all tags locally" option with SourceTree ) (并且你有SourceTree的“在本地获取并存储所有标签”选项

For the reason why upstream git tag not showing in forked repo 因为上游git标签没有显示在分叉回购中

For the missing tag in forked repo, it's mainly caused the fork operation did firstly, then the missing tag (as v1.11.57 for your situation) was pushed to upstream repo after forking. 对于forked repo中缺少的标记,它主要是首先导致fork操作,然后丢失的标记(对于你的情况为v1.11.57 )在分叉后被推送到上游repo。

The way to sync git tag from upstream repo to forked repo 从上游repo到forked repo同步git标签的方法

You can use below commands to sync missing tag from upstream to the forked repo: 您可以使用以下命令将缺失的标记从上游同步到分叉的仓库:

# In local forked repo
git remote add updtream <URL for upstream repo> -f
git push origin --tags

Then you will find the missing tags show in the forked repo. 然后你会发现在分叉的回购中显示缺失的标签。

I did it by following below commands. 我按照以下命令做到了。

In my local, 在我当地,

git remote add upstream https://upstreamurl.git
git fetch upstream
Now tags are in my local, I push it to my master branch
git push -f origin master

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM