kingBook

导航

git tag

更多参考:Git - 打标签 (git-scm.com)

 

命令行:

git tag -a v3.0 -m "这是4.0版本"
git push origin v3.0
# git tag -a 标签名称 -m "说明"
# git push origin 标签名称


# 附注标签
git tag -a v1.4 -m "my version 1.4"
# 轻量标签
git tag v1.4-lw 

# 在指定的提交上打标签
git tag -a v1.2 9fceb02
# 推送标签到远程
git push origin v1.5

  

删除tag

git tag -d v1.1  //删除本地tag

git push origin :v1.1//删除远程tag
//也可以这样  
git push origin --delete tag V1.1 

 

以上命令在项目仓库创建了一个v3.0的release,如下图:


 

1.进入到项目仓库,选择release选项卡,可以点击create a new release/Draft a new release创建一个新的release.

2.未勾选This is a pre-release通过github官方提供的api可访问我们的release信息,格式如下:

/repos/:owner/:repo/releases/:id

更多API说明访问:https://developer.github.com/v3/repos/releases/

例:访问https://api.github.com/repos/kingBook/testGit/releases/latest可以获取如下信息

{
  "url": "https://api.github.com/repos/kingBook/testGit/releases/9028810",
  "assets_url": "https://api.github.com/repos/kingBook/testGit/releases/9028810/assets",
  "upload_url": "https://uploads.github.com/repos/kingBook/testGit/releases/9028810/assets{?name,label}",
  "html_url": "https://github.com/kingBook/testGit/releases/tag/2.0",
  "id": 9028810,
  "tag_name": "2.0",
  "target_commitish": "master",
  "name": "testGit v2.0",
  "draft": false,
  "author": {
    "login": "kingBook",
    "id": 4969180,
    "avatar_url": "https://avatars3.githubusercontent.com/u/4969180?v=4",
    "gravatar_id": "",
    "url": "https://api.github.com/users/kingBook",
    "html_url": "https://github.com/kingBook",
    "followers_url": "https://api.github.com/users/kingBook/followers",
    "following_url": "https://api.github.com/users/kingBook/following{/other_user}",
    "gists_url": "https://api.github.com/users/kingBook/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/kingBook/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/kingBook/subscriptions",
    "organizations_url": "https://api.github.com/users/kingBook/orgs",
    "repos_url": "https://api.github.com/users/kingBook/repos",
    "events_url": "https://api.github.com/users/kingBook/events{/privacy}",
    "received_events_url": "https://api.github.com/users/kingBook/received_events",
    "type": "User",
    "site_admin": false
  },
  "prerelease": false,
  "created_at": "2017-05-03T08:34:10Z",
  "published_at": "2017-12-26T06:01:54Z",
  "assets": [

  ],
  "tarball_url": "https://api.github.com/repos/kingBook/testGit/tarball/2.0",
  "zipball_url": "https://api.github.com/repos/kingBook/testGit/zipball/2.0",
  "body": "这是第二个版本"
}

 

posted on 2017-12-26 14:37  kingBook  阅读(12687)  评论(0编辑  收藏  举报