這篇文章繼續介紹GitHub的操作
查看提交歷史
[tangyanjun@VM_216_80_centos git]$ git commit -m "bb"
# On branch master
nothing to commit (working directory clean)
[tangyanjun@VM_216_80_centos git]$ git log
commit 8b71690bcff6c97cfdc7d15124de666ee0b0fd92
Merge: 73abe69 6f2de08
Author: tangyanjun <519656780@qq.com>
Date: Wed Aug 2 16:28:30 2017 +0800
Merge branch 'change_site'
Conflicts:
bb.txt
commit 73abe69a44733a9f80787b3091ef347f78d8f9e4
Author: tangyanjun <519656780@qq.com>
Date: Wed Aug 2 16:27:08 2017 +0800
bb
commit 6f2de0800602ff5b78dc94b64dee78f992126f35
Author: tangyanjun <519656780@qq.com>
Date: Wed Aug 2 16:26:15 2017 +0800
bb
commit 44f2117cd6d188ea0c3f4e54abe32aff5f2d3d29
Author: tangyanjun <519656780@qq.com>
Date: Wed Aug 2 16:20:57 2017 +0800
–oneline 查看簡潔版本
[tangyanjun@VM_216_80_centos git]$ git log --oneline
8b71690 Merge branch 'change_site'
73abe69 bb
6f2de08 bb
44f2117 add
6b46afd hh
d44f785 commit aa.txt
–graph 選項查看分支合併
[tangyanjun@VM_216_80_centos git]$ git log --oneline --graph
* 8b71690 Merge branch 'change_site'
|\
| * 6f2de08 bb
* | 73abe69 bb
|/
* 44f2117 add
* 6b46afd hh
* d44f785 commit aa.txt
–author 查看指定用戶提交的日誌
[tangyanjun@VM_216_80_centos git]$ git log --oneline --graph --author=tangyanjun
* 8b71690 Merge branch 'change_site'
|\
| * 6f2de08 bb
* | 73abe69 bb
|/
* 44f2117 add
* 6b46afd hh
* d44f785 commit aa.txt
指定日期(2017年8月2日之後且在三週前的所有提交)
[tangyanjun@VM_216_80_centos git]$ git log --oneline --before={3.weeks.ago} --after={2017-08-02} --no-merges
標籤
[tangyanjun@VM_216_80_centos git]$ git tag -a v1.0
這時候會打開VIM編輯器,讓你在第一行添加標籤
添加之後:
[tangyanjun@VM_216_80_centos git]$ git log --decorate --oneline --graph
* 8b71690 (HEAD, tag: v1.0, master) Merge branch 'change_site'
|\
| * 6f2de08 (change_site) bb
* | 73abe69 bb
|/
* 44f2117 add
* 6b46afd (testing) hh
* d44f785 commit aa.txt
[tangyanjun@VM_216_80_centos git]$ git tag -a v1.0
fatal: tag 'v1.0' already exists
發佈之前忘記打標籤,可以追加:
[tangyanjun@VM_216_80_centos git]$ git tag -a v0.9 d44f785
d44f785是上面信息的最後一行
查看所有標籤:
git tag
指定簽名信息
[tangyanjun@VM_216_80_centos git]$ git tag -s yangniSB -m "yangni SB"
下篇文章介紹GitHub遠程倉庫的操作