Git: How do I pull a tagged revision into my fork?

后端 未结 2 666
滥情空心
滥情空心 2020-12-23 14:27

I have a fork of a project on github where the main trunk was recently tagged. I want to pull the code from the tagged revision into my fork. How would I do that?

2条回答
  •  被撕碎了的回忆
    2020-12-23 15:08

    I may be projecting, but I think Jon's problem was the same as mine:

    I forked someone else's project (on GitHub), and needed to point the master branch of my fork to a specific tag of their project, effectively ignoring all subsequent development. (Why? After that tag, their project dropped functionality that my fork depends on and must build on. So I'm pegged to that moment in history. Sad but true.)

    In this example, the tag was called 0.6.3. All I had to do was cd to my local clone (of my fork) and do

    git reset --hard 0.6.3
    git push --force
    

    Then I verified on GitHub that my fork reflected the state of the code at their tag!

提交回复
热议问题