Exploring Tig: A Command-Line Alternative to GitKraken
Written on
Chapter 1: Introduction to Tig
In the world of development, tools such as SourceTree and GitKraken are widely recognized for their ability to visualize commit histories and differences, making repository navigation more user-friendly. However, these graphical interfaces lose their effectiveness once you transition to the terminal, particularly when connecting to remote servers. Furthermore, these desktop applications are designed primarily for mouse usage, whereas many developers prefer the speed of keyboard navigation.
To address this, we can turn to tig, a command-line repository browser that brings efficiency back to terminal usage.
Installation
Installing tig is straightforward. For users on common Linux distributions, you can easily install it using your package manager. On Ubuntu, for instance, you would run:
sudo apt install tig
Mac users have the option to use Homebrew:
brew install tig
Windows users can take advantage of Git for Windows, which includes tig by default. If you're eager to use the latest version, you can compile it from the source as detailed on tig's official website.
How to Utilize Tig
After tig is installed, navigate to a directory housing a Git repository and launch tig via the command line. You will be greeted with a primary view displaying commit details at the bottom, akin to the output of git log --oneline. Use the arrow keys to scroll through the commits, and pressing Enter will reveal the details of a selected commit. To return to the list, simply hit 'q'. Pressing 'q' again will exit tig.
Tig features multiple views; the commit list is known as the main view. You can effortlessly return to this view by pressing 'm'. The diff view, which provides detailed information about a commit, can be accessed by pressing 'd'. You can toggle between these views using 'm' and 'd' respectively.
Overall, tig's navigation is reminiscent of vim or less, and initiating a search in the current view is as simple as typing a slash.
The first video titled "Best Git GUI's Compared 2022" dives into various Git GUI tools, comparing their features and usability.
Tig's extensive functionalities allow for versatile repository exploration, and you can discover its full range of features and key bindings by pressing 'h'.
Configuration of Tig
Tig is highly customizable. To modify its settings, create a file named .tigrc in your home directory. The structure for adding settings is straightforward:
set variable = value
For example, to display 25 lines before and after each diff, you can add:
set diff-context = 25
While tig comes with sensible default settings, users can tailor their experience based on personal preferences, with numerous options available on tig's website.
Recap
In summary, tig is an exceptional command-line repository browser that enhances the experience compared to SourceTree and GitKraken, especially for keyboard-centric users. If you are accustomed to vim or less, you will find tig intuitive and efficient.
Give tig a try!
Useful Links:
- SourceTree
- GitKraken
- tig
- Homebrew - the package manager for macOS
- Git for Windows
Chapter 2: Enhancing Your Git Experience
The second video, "GitKraken Makes Git Even More Awesome - And Easy to Use," showcases how GitKraken simplifies Git operations and enhances user experience.