Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【git】前端打包,版本发布,回滚流程 #13

Open
Kelichao opened this issue Jul 14, 2017 · 0 comments
Open

【git】前端打包,版本发布,回滚流程 #13

Kelichao opened this issue Jul 14, 2017 · 0 comments

Comments

@Kelichao
Copy link
Owner

Kelichao commented Jul 14, 2017

git生成tag标签本地

# 创建附注的本地标签
$ git tag -a v0.1.2 -m "0.1.2版本"

 # 删除本地标签
$ git tag -d v0.1.2

# 为历史提交点补打标签 
$ git log #得到历史提交的hash值(可用于回滚)
$ git tag -a v0.1.1 9fbc3d0  #为该hash值打标签

git生成tag标签远端操作

通常的git push不会将标签对象提交到git服务器,我们需要进行显式的操作:

# 将tag推送到远端
$ git push origin v0.1.2 # 将v0.1.2标签提交到git服务器
$ git push origin –tags # 将本地所有标签一次性提交到git服务器

# 将tag从远端删除(此操作需要管理员权限)
$ git push origin :refs/tags/v0.1.2

将当前分支,合并到主干

  1. 先切换回原来的master分支 git checkout master
  2. 通过merge指令将dev的代码合并到master git merge dev
  3. 提交代码到远端仓库 git push origin master 注意解决冲突

回滚代码到指定分支

注:git checkout v0.21,此时会指向打v0.21标签时的代码状态,(但现在处于一个空的分支上,远端也为空)

  • 此时会出现警告,但不影响操作
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
# 切换代码到分支tag
git checkout "v0.1.2"
  • 然后运行打包命令即可生成代码文件

可选操作

搜索近似版本号

搜索近似版本号 git tag "v0.1.*"
image

版本号规则

image

参考网址1
参考网址2

@Kelichao Kelichao changed the title 【git】前端打包,版本发布回滚流 【git】前端打包,版本发布,回滚流程 Jan 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant