git实战-2、gitk使用

git实战-2、gitk使用

前言

gitk官方介绍:
https://git-scm.com/docs/gitk

概念:显示存储库或选定提交点的更改信息。这包括可视化commit图,显示与每个commit相关的信息,以及每个修订的树中的文件。

使用git客户端,试图理解git世界中checkout,commit,branch,remote,rebase等术语

在window客户端进入到git仓库,使用命令打开gitk工具窗:

gitk --all

gitk可视化页面说明

git实战-2、gitk使用

说明信息:

  1. 左上方窗格显示了此存储库的一系列提交,其中最新的提交位于顶部。
  2. 右边窗格显示所选提交的用户信息和提交时间
  3. 所选提交的message
  4. 名为“master”的本地分支,它指向最近的提交
  5. 远程引用分支,远程存储库的名为“origin”的“master”分支,指向最近的提交。
  6. 黄点表示上次提交点HEAD、红色表示本地还存在未add的文件、绿色表示本地改变的文件已经add,但是还没有提交、蓝色表示已经提交的记录
  7. 所选提交的详情,author:作者,commiter:提交者,Parent:上次提交的SHA ID,child:下次提交的SHA ID,branch所提交的分支,follows:跟进者,precedes:领先
  8. 提交的提交SHA ID(唯一标识符,类似于subversion修订号)
  9. 本次提交变化的文件
    10、提交文件的基本信息

git操作和gitk视图变化

新建dev分支,F5刷新gitk工具,视图刷新,我们可以进行一些git常规操作,去F5刷新对应gitk视图,进行可视化的查看git status

git branch dev

git实战-2、gitk使用

git checkout dev

git实战-2、gitk使用

git commit -am"test commit"

git实战-2、gitk使用

查看gitk,出现dev黄色提交点,说当前库指向了新的分支ddev。

git实战-2、gitk使用

切回去master库,git checkout master

git merge dev

git实战-2、gitk使用

git branch -d dev

git实战-2、gitk使用

给test_commit2 创建一个标签 2.31

git实战-2、gitk使用

git选项说明

摘自:https://git-scm.com/docs/gitk

–all
Show all refs (branches, tags, etc.).

–branches[=]
–tags[=]
–remotes[=]
Pretend as if all the branches (tags, remote branches, resp.) are listed on the command line as . If is given, limit refs to ones matching given shell glob. If pattern lacks ?, , or [, / at the end is implied.

–since=
Show commits more recent than a specific date.

–until=
Show commits older than a specific date.

–date-order
Sort commits by date when possible.

–merge
After an attempt to merge stops with conflicts, show the commits on the history between two branches (i.e. the HEAD and the MERGE_HEAD) that modify the conflicted files and do not exist on all the heads being merged.

–left-right
Mark which side of a symmetric difference a commit is reachable from. Commits from the left side are prefixed with a < symbol and those from the right with a > symbol.

–full-history
When filtering history with …​, does not prune some history. (See “History simplification” in git-log[1] for a more detailed explanation.)

–simplify-merges
Additional option to --full-history to remove some needless merges from the resulting history, as there are no selected commits contributing to this merge. (See “History simplification” in git-log[1] for a more detailed explanation.)

–ancestry-path
When given a range of commits to display (e.g. commit1…commit2 or commit2 ^commit1), only display commits that exist directly on the ancestry chain between the commit1 and commit2, i.e. commits that are both descendants of commit1, and ancestors of commit2. (See “History simplification” in git-log[1] for a more detailed explanation.)

-L,:
-L::
Trace the evolution of the line range given by “,” (or the function name regex ) within the . You may not give any pathspec limiters. This is currently limited to a walk starting from a single revision, i.e., you may only give zero or one positive revision arguments. You can specify this option more than once.