我是 Git hub 的新手,我对标签和分支的概念感到困惑(已解释 here ) 我想从 git hub 获得稳定版本的 PhantomJS(版本 2.1.0)。但我不明白我是否应该这样做:
git checkout master
git remote add upstream https://github.com/ariya/phantomjs.git
git fetch upstream
git rebase --onto tags/2.1.0 upstream/master master
或
git init
git remote add -t 2.1 -f origin https://github.com/ariya/phantomjs.git
git checkout 2.1
你能解释一下是哪一个吗?为什么?
最佳答案
您应该只克隆存储库,然后 checkout 标签:
$ git clone https://github.com/ariya/phantomjs.git
$ cd phantomjs
$ git checkout 2.1
请记住,在标签上,您不能提交您将进行的任何本地更改。为此,你必须在一个分支上。令人困惑的是,该命令对于分支和标签都是 git checkout
。
关于Github分支,标签: How to get a specific release of a code?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38384670/