16、tag 标签,由于commit都是以hash记录,所以tag是为快速定义而准备的
[root@linuxidc git]# git log --oneline #查看commit版本的hash
2989e89 New add rom Sunshine
bf266f5 code1.py New add row Sunshine Good
7894d32 New add code1.py
b421347 New add code.py
[root@linuxidc git]# git tag v0.1.2 2989e89 #为hash值2989e89打上标签v0.1.2
[root@linuxidc git]# git tag v0.1.3 bf266f5 #为hash值bf266f5打上标签v0.1.3
[root@linuxidc git]# git tag
v0.1.1
v0.1.2
v0.1.3
[root@linuxidc git]# git tag v0.1.4 #修改代码或者增加功能都可以直接给上tag
[root@linuxidc git]# git show 2989e89 #使用hash查找
commit 2989e8927da83be9087933c17b074adeb2e91e2c
Author: sunshine <sunshine@git.com>
Date: Wed Oct 5 23:49:07 2016 +0800
New add rom Sunshine
diff --git a/code.py b/code.py
index e69de29..3a2a051 100644
--- a/code.py
+++ b/code.py
@@ -0,0 +1 @@
+print 'Sunsine !'
[root@linuxidc git]# git show v0.1.2 #使用标签查找
commit 2989e8927da83be9087933c17b074adeb2e91e2c
Author: sunshine <sunshine@git.com>
Date: Wed Oct 5 23:49:07 2016 +0800
New add rom Sunshine
diff --git a/code.py b/code.py
index e69de29..3a2a051 100644
--- a/code.py
+++ b/code.py
@@ -0,0 +1 @@
+print 'Sunsine !'
[root@linuxidc git]# git tag -d v0.1.1 #删除标签
Deleted tag 'v0.1.1' (was 2989e89)
[root@linuxidc git]# git tag
v0.1.2
v0.1.3
17、pull 获取,这个用到我们之前搭建的gitolite
[root@redis_master dev]# git pull origin master #没发现有人push,所以拉不到信息
From 127.0.0.1:dev
* branch master -> FETCH_HEAD
Already up-to-date.
[root@redis_master dev]# git push -f #为了测试这边使用-f强制覆盖更新
Counting objects: 32, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (19/19), done.
Writing objects: 100% (32/32), 2.94 KiB, done.
Total 32 (delta 0), reused 0 (delta 0)
To git@127.0.0.1:dev
+ 4197bf0...addfd8f master -> master (forced update)
[root@redis_master dev]# git pull #再试一下git pull
remote: Counting objects: 24, done.
remote: Compressing objects: 100% (16/16), done.
remote: Total 23 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (23/23), done.
From 127.0.0.1:dev
+ 4197bf0...addfd8f master -> origin/master (forced update)
Merge made by recursive.
855.py | 4 ++++
class.php | 1 +
2 files changed, 5 insertions(+), 0 deletions(-)
create mode 100644 855.py
create mode 100644 class.php
[root@redis_master dev]# ll #拉取到代码了
total 8
-rw-r--r--. 1 root root 45 Oct 6 01:03 855.py
-rw-r--r--. 1 root root 4 Oct 6 01:03 class.php