Search code examples
gitgit-taggit-fetch

GIT fetch from another repo -- how to push correct tags


I have a repo B which "branched" from another some time ago. However, I still need to apply some commits from its "father" repo A from time to time. So, in repo B I did:

git remote add repoA [email protected]
git fetch repoA

Now, in repo B I can, for example, cherry pick some of the things that keep on happening on repo A...

However, when I do git push --tags he tries to push to repo B all of its tags plus the tags from repo A.

  1. What is the correct process to push only the tags belonging to repo B to origin?
  2. In general, am I working correctly with Git for this particular case, when I still to need merge some things from a "long gone" father into some repo? Am I risking to push "garbage" into the repo B

Solution

  • You can try (git 1.8.3+, May 2013):

    git push --follow-tags
    

    That should push only the commits and tags from your current branch in one command (if your push policy is set to simple)