github fork项目不带tag解决

github中fork别人的项目,clone下来后发现只有代码,没有tag,而我们现在想基于某个tag生成新分支,然后基于这个分支来开发。

第一步,需要把原来的tag都同步过来

# Fork源仓库
# Repo: aaa/project
# Fork: bbb/project

# Track:
# 克隆你的仓库
git clone https://github.com/bbb/project.git 

# 进入你的仓库本地目录
cd project

# 添加原始仓库地址
git remote add upstream https://github.com/bbb/project.git

# Update:
# 拉取原始仓库数据
git fetch upstream --tags
# 如果你的主分支不是叫master,就把前面的master换成你的名字,比如main之类
git rebase upstream/master

# 推送
git push

# 推送tags
git push --tags

第二步,基于某个tag新建分支,并推送到远程仓库

# 查看所有tag
git tag

# 4. 检出指定的 tag 到新分支
# 替换 'tag_name' 为你想要的 tag 名称
git checkout -b new_branch_name tag_name

# 将新分支推送到远程仓库
git push -u origin new_branch_name

参考文献
https://www.cnblogs.com/bodong/p/17891893.html

相关推荐

  1. github fork项目tag解决

    2024-04-30 05:56:06       29 阅读
  2. kotlin 项目中文件显示.kt 结尾与.kt结尾

    2024-04-30 05:56:06       51 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-04-30 05:56:06       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-04-30 05:56:06       100 阅读
  3. 在Django里面运行非项目文件

    2024-04-30 05:56:06       82 阅读
  4. Python语言-面向对象

    2024-04-30 05:56:06       91 阅读

热门阅读

  1. el-row中元素如何上下居中对齐?

    2024-04-30 05:56:06       35 阅读
  2. python基础知识

    2024-04-30 05:56:06       31 阅读
  3. leetcode15-3Sum

    2024-04-30 05:56:06       156 阅读
  4. 烟雾识别图像处理方法详解---豌豆云

    2024-04-30 05:56:06       34 阅读
  5. C++中的STL——queue类的基本使用

    2024-04-30 05:56:06       32 阅读
  6. 2024年北京高校数学建模校际联赛竞赛赛题浅析

    2024-04-30 05:56:06       36 阅读
  7. windows11 磁盘扩容删除恢复分区

    2024-04-30 05:56:06       28 阅读