Github分支,标签: How to get a specific release of a code?

标签 git github git-branch git-tag

我是 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/

相关文章:

git - 为同一项目中的不同模块设置不同的 git root - Intellij IDEA

Github 无法从基础分支发出 Pull 请求

git - git checkout HEAD -- filename 和 git checkout -- filename 的区别

git - 在 Github 中添加 git 标签时触发发布管道

git - 在变量中分配命令的结果

git:如何以交互方式逐个分支删除远程仓库中不存在的本地分支?

git - 查看不同 Git 分支中的文件而不更改分支

Git interactive rebase,无需使用编辑器即可编辑特定提交?

linux - 如何在 Linux (Centos) 机器上安装此软件包?

python - PyPI 安装和 tarball 中缺少我的包的 requirements.txt 文件