Why I really like Tig for visualizing my Git workflows
Sumantro Mukherjee
Tue, 07/05/2022 – 03:00
If you discover navigating your Git repositories frustratingly advanced, have I received the instrument for you. Meet Tig.
Tig is an ncurses-based text-mode interface for Git that means that you can browse modifications in a Git repository. It additionally acts as a pager for the output of assorted Git instructions. I exploit this instrument to offer me a good suggestion of what’s been modified by which commit by whom, the most recent commit merged, and a lot extra. Try it for your self, beginning with this temporary tutorial.
Installing Tig
On Linux, you possibly can set up Tig utilizing your package deal supervisor. For occasion, on Fedora and Mageia:
$ sudo dnf set up tig
On Debian, Linux Mint, Elementary, Pop_OS, and different Debian-based distributions:
$ sud apt set up tig
On macOS, use MacPorts or Homebrew. Tig’s full set up information will be discovered within the Tig Manual.
Using Tig
Tig supplies an interactive view of widespread Git output. For occasion, with Git you possibly can view all refs with the command git show-ref
:
$ git show-ref
98b108... refs/heads/grasp
6dae95... refs/remotes/origin/1010-internal-share-partition-format-reflexion
84e1f8... refs/remotes/origin/1015-add-libretro-openlara
e62c7c... refs/remotes/origin/1016-add-support-for-retroarch-project-cd
1c29a8... refs/remotes/origin/1066-add-libretro-mess
ffd3f53... refs/remotes/origin/1155-automatically-generate-assets-for-external-installers
ab4d14... refs/remotes/origin/1160-release-on-bare-metal-servers
28baa9... refs/remotes/origin/1180-ipega-pg-9118
8dff1d... refs/remotes/origin/1181-add-libretro-dosbox-core-s
81a7fe... refs/remotes/origin/1189-allow-manual-build-on-master
[...]
With Tig, you may get that data and way more in a scrollable listing, plus keyboard shortcuts to open extra views with particulars about every ref.
Pager mode
Tig enters pager mode when enter is offered to stdin (commonplace enter). When the present
subcommand is specified and the --stdin
choice is given, stdin is assumed to be an inventory of commit IDs, which is forwarded to git-show
:
$ git rev-list --author=sumantrom HEAD | tig present –stdin
Log and diff views
When you are in Tig’s log view, you possibly can press the d key in your keyboard to show diffs. This shows the information modified within the commit and the traces that have been eliminated and added.
Interactive Git information
Tig is a superb addition to Git. It makes it straightforward to evaluation your Git repository by encouraging you to discover the logs with out having to assemble lengthy and generally advanced queries.
Add Tig to your Git toolkit at the moment!
Tig is a superb instrument for reviewing your Git repository by encouraging you to discover the logs with out having to assemble lengthy and generally advanced queries.