git(六)-标签与diff

新建标签,标签有两种:轻量量级标签(lightweight)与带有附注标签
(annotated)
• 创建⼀一个轻量量级标签
• git tag v1.0.1
• 创建⼀一个带有附注的标签
• git tag -a v1.0.2 -m ‘release version’
• 删除标签
• git tag -d tag_name

操作:

Administrator@CeaserWang MINGW64 /e/Study/mygit (dev)
$ git tag v1.0

Administrator@CeaserWang MINGW64 /e/Study/mygit (dev)
$ git tag
v1.0

Administrator@CeaserWang MINGW64 /e/Study/mygit (dev)
$ git tag -a v1.2 -m 'v1.2 released'

Administrator@CeaserWang MINGW64 /e/Study/mygit (dev)
$ git tag
v1.0
v1.2

查找:

$ git tag -l 'v1.0'
v1.0

删除:

Administrator@CeaserWang MINGW64 /e/Study/mygit (dev)
$ git tag -d v1.0
Deleted tag 'v1.0' (was 080a6d7)

Administrator@CeaserWang MINGW64 /e/Study/mygit (dev)
$ git tag
v1.2

标签不依赖特定的分支:

Administrator@CeaserWang MINGW64 /e/Study/mygit (dev)
$ git tag
v1.2

Administrator@CeaserWang MINGW64 /e/Study/mygit (dev)
$ git checkout master
Switched to branch 'master'

Administrator@CeaserWang MINGW64 /e/Study/mygit (master)
$ git tag
v1.2

git blame命令:

blame的作用是查看文件的修改是哪个作者操作的。

$ git blame test.txt
1806ac5e (ceaser 2017-07-30 11:57:14 +0800 1) first commit
1806ac5e (ceaser 2017-07-30 11:57:14 +0800 2) second commit
25db944e (ceaser 2017-07-30 11:57:56 +0800 3) third commit
821425dc (ceaser 2017-07-30 11:58:26 +0800 4) fourth commit
9b95dda7 (ceaser 2017-07-30 14:53:25 +0800 5) hello java
9b95dda7 (ceaser 2017-07-30 14:53:25 +0800 6) hello node

git diff命令:
diff比较的是暂存区和工作区的内容的不同。

$ git diff
diff --git a/test.txt b/test.txt
index 4151b86..e304045 100644
--- a/test.txt  //暂存区文件
+++ b/test.txt  //工作区文件
@@ -4,3 +4,4 @@ third commit
 fourth commit
 hello java
 hello node
+hello python  //工作区比暂存区多了一行

git diff HEAD 比较的是最新的提交和工作区的差别,HEAD可以换成某一个提交id

$ git diff HEAD
diff --git a/test.txt b/test.txt
index e304045..d18bc0f 100644
--- a/test.txt
+++ b/test.txt
@@ -2,6 +2,3 @@ first commit
 second commit
 third commit
 fourth commit
-hello java
-hello node
-hello python

 
git diff –cached commit_id 比较的最新的提交和暂存区的差别。
这里写图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值