In a recent article, we’ve described how to install and use GRV tool for viewing Git repositories in Linux terminal. In this article, we would like to introduce to you another useful command-line based interface to git called Tig.
Tig is a free open source, cross platform ncurses-based text-mode interface for git. It is a straight-forward interface to git that can help in staging changes for commit at chunk level and works as a pager for output from different Git commands. It can run on Linux, MacOSX as well as Windows systems.
How to Install Tig in Linux Systems
To install Tig in Linux, you need to first clone the Tig repository to your system and install it as shown.
$ git clone git://github.com/jonas/tig.git $ make $ make install
By default, tig will be installed under $HOME/bin
directory, but ff you wish to install it in another directory under in your PATH, set prefix to the desired path, as shown.
$ make prefix=/usr/local $ sudo make install prefix=/usr/local
Once you have installed Tig on your system, using the cd command get into your any of your local git repositories and run tig without any arguments, which should show all commits for the repository.
$ cd ~/bin/shellscripts/ $ tig
To quit Tig, press q
to close it.
Display Repository Activity Log
To display a log activities of the above repository, use the log sub-command.
$ tig log
Show Repository Objects
The show sub-command allows you to display one or more objects such as commits and many more, in a more detailed way, as shown.
$ tig show commits
Search A Pattern/Word in Git Files
You can also search for a particular pattern (for example the word check) in your git files with the grep sub-command, as shown.
$ tig grep check
Display Git Repository Status
To display status of your git repository use status sub-command as shown.
$ tig status
For more Tig usage, please refer to help section or visit the Tig Github repository at https://github.com/jonas/tig.
$ tig -h
Tig is a simple ncurses-based interface to git repositories and mainly act as a Git repository browser. Give us your feedback or ask any questions via the comment form below.