Git标签
标签就代表着版本
git tag -a 指定版本号 -m "说明"
git tag -a 版本号 哈希值 -m "说明"对其它快照打标签
[root@kk data]# git tag -a v1.0 -m "tag v1.0" [root@kk data]# git log --oneline --decorate 69941bd (HEAD, tag: v1.0, master) add file a e16a96a add file a [root@kk data]# git tag -a v1.1 e16a96a -m "tag v1.1 add a"
查看标签git tag
[root@kk data]# git tag v1.0 v1.1
查看标签更改了什么git show 标签名
[root@kk data]# git show v1.0
tag v1.0
Tagger: kk <30772818@qq.com>
Date: Wed Feb 12 10:50:39 2020 +0800
tag v1.0
commit 69941bd1c5c1ef452956b60ce69050d307e3ce79
Author: kk <30772818@qq.com>
Date: Mon Feb 10 23:18:37 2020 +0800
add file a
diff --git a/a b/a
new file mode 100644
index 0000000..e69de29
可以使用标签进行穿越
[root@kk data]# git log --oneline --decorate 69941bd (HEAD, tag: v1.0, master) add file a e16a96a (tag: v1.1) add file a [root@kk data]# git reset --hard v1.1 HEAD is now at e16a96a add file a [root@kk data]# git log --oneline --decorate e16a96a (HEAD, tag: v1.1, master) add file a 要是想要再穿越回去使用标签非常方便 [root@kk data]# git tag v1.0 v1.1 [root@kk data]# git reflog e16a96a HEAD@{0}: reset: moving to v1.1 69941bd HEAD@{1}: commit: add file a e16a96a HEAD@{2}: commit (initial): add file a [root@kk data]# git reset --hard v1.0 HEAD is now at 69941bd add file a [root@kk data]# git log --oneline --decorate 69941bd (HEAD, tag: v1.0, master) add file a e16a96a (tag: v1.1) add file a
删除标签git tag -d 标签名
[root@kk data]# git tag v1.0 v1.1 [root@kk data]# git tag -d v1.1 Deleted tag 'v1.1' (was 442133c) [root@kk data]# git tag v1.0
Github
Github顾名思义是一个Git版本库的托管服务,是目前全球最大的软件仓库,拥有上百万的开发者用户也是软件开发和寻找资源的最佳途径,Github不仅可以托管各种Git版本仓库还拥有更美观的web界面,自己的代码可以被任何人克隆,使得开发者为开源项贡献代码变得更加容易,当然也可以付费购买私有库,高性价比的私有库可以并帮助很多团队和企业
- 注册用户
- 配置ssh-key
- 创建项目
- 克隆项目到本地
- 推送新代码到github
创新版本库
添加远程仓库名称为origin
[root@web01 data]# git remote add origin git@github.com:he30772818/git_data1.git 检查是否添加成功 [root@web01 data]# git remote origin
推送master主干上origin远程仓库
git push -u origin master(选择了ssh要先做免密钥,不然推不上去)
[root@web01 ~]# cat .ssh/ authorized_keys id_dsa.pub id_rsa.pub in_rsa.pub id_dsa id_rsa in_rsa known_hosts [root@web01 ~]# cat .ssh/id_rsa.pub ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCvc2TL8K1y+4AgWzuRD5SAJvnBrE+zfP68ICFjcy2U9azwrtyNnow1mFkFSBXrRiCD3PiTuhwfzEoJcZc9NMN6/q2o6kOKVA4bk04b+tMrYZRSDgy+e3geZ9pkl4fRii3h2U5cCLD4KJtfi4QTSTJLIbIZsTKI8yV5O7khj8TYJCy7QJeauWZxRmt9JLBtAshIkvdjwEUNYQRssf3mtvUHdODQ6qboM/C0e4C6JR6YvGqo81Ix4RfRQX3LRqmOUQfXRNTiMopQhBuO2kUa03xJhNnfrKT3JlcwdDe5a8KBegwyk1ZDWE8/Ep/A8+/ksTdfp1znslO56yXtC2TW73yV root@web01
上传公钥
再次推送
[root@kk data]# git push -u origin master The authenticity of host 'github.com (52.74.223.119)' can't be established. RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8. RSA key fingerprint is MD5:16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'github.com,52.74.223.119' (RSA) to the list of known hosts. Counting objects: 5, done. Delta compression using up to 2 threads. Compressing objects: 100% (4/4), done. Writing objects: 100% (5/5), 387 bytes | 0 bytes/s, done. Total 5 (delta 0), reused 0 (delta 0) To git@github.com:he30772818/git_data1.git * [new branch] master -> master Branch master set up to track remote branch master from origin.
登陆github进行查看git1_data远程仓储
在linux上想要下载github上的代码就可以执行
git clone xxxx 下载下来的文件目录名称和远程仓库名称一致
[root@kk data]# git clone git@github.com:he30772818/git_data1.git Cloning into 'git_data1'... Warning: Permanently added the RSA host key for IP address '13.250.177.223' to the list of known hosts. remote: Enumerating objects: 5, done. remote: Counting objects: 100% (5/5), done. remote: Compressing objects: 100% (4/4), done. remote: Total 5 (delta 0), reused 5 (delta 0), pack-reused 0 Receiving objects: 100% (5/5), done. [root@kk data]# ll total 4 -rw-r--r-- 1 root root 0 Feb 12 11:09 a -rw-r--r-- 1 root root 0 Feb 10 19:20 b -rw-r--r-- 1 root root 0 Feb 10 19:20 c drwxr-xr-x 3 root root 4096 Feb 12 14:10 git_data1
继续阅读

我的微信
这是我的微信扫一扫
评论