Using tig

Updated . Posted . Visible to the public. Repeats.

tig is a command line explorer for Git that is just awesome. Install via apt-get or brew.

Handy commands

  • t ("tree"): Directory-structure based access. You'll see the current directory annotated with the latest change date and its author. Navigate with arrow keys or vim.
  • b ("blame"): Opens the file under the cursor and annotates each line with change date and author.
  • d ("diff"): Like ENTER on a commit, but arrow keys will scroll the diff!
  • /: Search current view (e.g. commit list, diff). Jump to next hit with n. Case-sensitive!
  • ENTER: Dive into the highlighted line, e.g. open a commit
  • q: Go back to the previous view, e.g. close a file
  • SHIFT + q: Exit
  • TAB: Switch focus between views, e.g. the commits list and the commit diff

Other features

  • Path-based access. Start tig with tig <file or path or glob>. It will boot with the commit list filtered to those that touched the given file(s).
  • Interactive Git status. Run tig status. Stage/unstage with U, navigate with ENTER/Q.
  • Stash management. Call tig stash, browse the stashes, apply with a, pop with p, drop with !. See Git: How to look at the stash

Config file

tig is configured in your ~/.gitconfig file. I have the following section there:

[tig]
  main-view-date-display = relative-compact # Highly recommended
  main-view-commit-title-graph = v1
  main-view-author-display = abbreviated # More compact
  main-view-id-display = yes
Dominik Schöler
Last edit
Dominik Schöler
License
Source code in this card is licensed under the MIT License.
Posted by Dominik Schöler to makandra dev (2015-08-12 06:34)