Tig – A Command Line Browser for Git Repositories

[‘

n

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.

n

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.

n

How to Install Tig in Linux Systems

n

To install Tig in Linux, you need to first clone the Tig repository to your system and install it as shown.

n

$ git clone git://github.com/jonas/tig.gitrn$ makern$ make installrn

n

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.

n

$ make prefix=/usr/localrn$ sudo make install prefix=/usr/localrn

n

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.

n

$ cd ~/bin/shellscripts/rn$ tig  rn

n

Show Git Repository Commits
Show Git Repository Commits

n

To quit Tig, press q to close it.

n

Display Repository Activity Log

n

To display a log activities of the above repository, use the log sub-command.

n

$ tig logrn

n

View Git Repository Log
View Git Repository Log

n

Show Repository Objects

n

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.

n

$ tig show commitsrn

n

Show Git Repository Objects
Show Git Repository Objects

n

Search A Pattern/Word in Git Files

n

You can also search for a particular pattern (for example the word check) in your git files with the grep sub-command, as shown.

n

$ tig grep check rn

n

Search a Work in Git Repository
Search a Work in Git Repository

n

Display Git Repository Status

n

To display status of your git repository use status sub-command as shown.

n

$ tig statusrn

n

Show Git Repository Status
Show Git Repository Status

n

For more Tig usage, please refer to help section or visit the Tig Github repository at https://github.com/jonas/tig.

n

$ tig -hrn

n

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.

n

‘]