22

I have the 1.11.57 tag in the upstream which i pushed with master branch code. I am using bitbucket and git bash

enter image description here

I forked above repository and locally use the fork repository as my local master branch. But in my forked repository the 1.11.57 tag is not showing.

enter image description here

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.

3
  • Can you show the screen shots of the commits for the original repo and the forked repo separately (as the example ibb.co/f1YbqT)?
    – Marina Liu
    Jun 25, 2018 at 8:59
  • Actually I can see the commit with tag version in my upstream. But in the fork i can see the commit with out a tag
    – Harshana
    Jun 25, 2018 at 17:48
  • 1
    hae your problem been solved yet? If yes, can you mark the answer? And it will also benefit others who meet similar questions :)
    – Marina Liu
    Jul 2, 2018 at 3:42

4 Answers 4

34

Make sure you have push all tags from your first cloned repo. With SourceTree: check the "Push all tags" box on the "Push" dialog box.

Only then would forking 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 tags from my local to my master branch
git push -f --tags origin master

(You can also add the new remote with SourceTree)
(And you have the "Fetch and store all tags locally" option with SourceTree)

3
  • i am using bitbucket and git bash
    – Harshana
    Jun 24, 2018 at 9:45
  • OK, so the Git commands I mention in the answer should help here.
    – VonC
    Jun 24, 2018 at 9:49
  • When i enter below command from locally it successfully show the remote repository and branches. I dont think my upstream has a issue git remote show origin Fetch URL: bitbucketpath/myservice.git Push URL: bitbucketpath/myservice.git HEAD branch: master Remote branches: master tracked
    – Harshana
    Jun 25, 2018 at 5:06
5

For the reason why upstream git tag not showing in forked repo

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.

The way to sync git tag from upstream repo to forked repo

You can use below commands to sync missing tag from upstream to the forked repo:

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

Then you will find the missing tags show in the forked repo.

3

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
2
  • So essentially what I recommended?
    – VonC
    Jul 8, 2018 at 6:45
  • Yep I add the push command to your answer. If you accept that edit, ill mark your answer as correct answer
    – Harshana
    Jul 8, 2018 at 7:31
1

Just to add to what was written above, I also had to run:

git fetch upstream --tags

To get it to actually pull the tags from upstream.

So if like me, the tag were not showing up, add this after the previously mentioned git fetch upstream

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.