Updated: Using tig

Posted . Visible to the public. Auto-destruct in 54 days

Re-organized card.

Config file is highly recommended!

Changes

  • -`tig` is a command line explorer for git that is just awesome. Install via `apt-get` or `brew`.
  • +`tig` is a command line explorer for Git that is just awesome. Install via `apt-get` or `brew`.
  • -## Navigating
  • -
  • -Generally speaking, `tig` is controlled similar to `vim`.
  • +## 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
  • +- `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
  • -## Features
  • -
  • -### tree view
  • -
  • -Hit `t`. You'll see the current directory annotated with the latest change date and its author. Navigate with arrow keys or vim.
  • -
  • -### blame
  • -
  • -Press `b` (as in `b`lame). `tig` will open the file under the cursor and annotate each line with change date and author.
  • -
  • -### search for commit messages
  • -
  • -Type `/`, then your search phrase *case sensitive* and press `ENTER`. `tig` will jump to commits whose message contains the search phrase, as you repeatedly press `N`.
  • -
  • -### see history of a certain file/path
  • -
  • -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).
  • -
  • -[view status and un/stage files](/makandra/31081)
  • -: Call `tig status`. You will see something similar to `git status`, however, it's interactive. Un/stage with `U`, navigate with `ENTER/Q`.
  • -
  • -### explore stashed items
  • +## 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`. See [Git: How to look at the stash](/makandra/11565)
  • -Call `tig stash`. See [Git: How to look at the stash](/makandra/11565)
  • -## Configuration
  • +## Config file
  • `tig` is configured in your `~/.gitconfig` file. I have the following section there:
  • ```
  • [tig]
  • - main-view-date-display = relative-compact
  • + main-view-date-display = relative-compact # Highly recommended
  • main-view-commit-title-graph = v1
  • - main-view-author-display = abbreviated
  • + main-view-author-display = abbreviated # More compact
  • main-view-id-display = yes
  • ```
Dominik Schöler
License
Source code in this card is licensed under the MIT License.
Posted by Dominik Schöler to makandra dev (2024-10-10 11:25)