- Git Version Control Cookbook
- Aske Olsson Rasmus Voss
- 329字
- 2021-12-08 12:33:48
Viewing history with Gitk
We saw earlier how we can view the history (the DAG) and visualize it with the use of git log
. However, as the history grows, the terminal representation of the history can be a bit cumbersome to navigate. Fortunately, there are a lot of graphical tools around Git, one of them being Gitk, which works on multiple platforms (Linux, Mac, and Windows).
This recipe will show you how to get started with Gitk.
Getting ready
Make sure you have Gitk installed:
$ which gitk /usr/local/bin/gitk
If nothing shows up, Gitk in not installed on your system, or at least is not available on your $PATH
.
Change the directory to the data-model
repository from the objects and DAG examples. Make sure the master branch is checked out and pointing to 34acc37
:
$ git checkout master && git reset --hard 34acc37
How to do it...
In the repository, run gitk --all &
to bring up the Gitk interface. You can also specify the commit range or branches you want similar to git log
or provide --all
to see everything:
$ gitk --all &

How it works...
Gitk parses the information for every commit and the objects attached to it to provide an easy graphical information screen that shows a graph of the history, author, and timestamp for each commit. In the bottom half, the commit message and the patches for each file changed and the list of files changed by the selected commit are displayed.
Though very lightweight and fast, Gitk is a very powerful tool. There are many different context menus regarding clicking on a commit, a branch, or a tag in the history view. You can create and delete branches, revert and cherry-pick commits, diff selected commits, and much more.
There's more...
From the interface, you can perform a find and search. Find looks through the history and search looks through the information displayed in the lower half of Gitk for the currently highlighted commit.
- Magento 2 Theme Design(Second Edition)
- R語言游戲數(shù)據(jù)分析與挖掘
- Learning Informatica PowerCenter 10.x(Second Edition)
- 精通軟件性能測試與LoadRunner實戰(zhàn)(第2版)
- oreilly精品圖書:軟件開發(fā)者路線圖叢書(共8冊)
- C語言程序設(shè)計案例式教程
- Mastering LibGDX Game Development
- JavaScript+Vue+React全程實例
- WordPress Plugin Development Cookbook(Second Edition)
- Bootstrap 4:Responsive Web Design
- QGIS By Example
- Kotlin從基礎(chǔ)到實戰(zhàn)
- Corona SDK Mobile Game Development:Beginner's Guide(Second Edition)
- 西門子S7-200 SMART PLC編程從入門到實踐
- Python深度學(xué)習(xí):模型、方法與實現(xiàn)