Software

I Switched from Git: How This Open-Source Linux App Revolutionized My Workflow

If you’re looking to simplify your Git experience, a new Linux terminal application called Lazygit might be just what you need. With its user-friendly keyboard interface and adaptable layout, Lazygit makes managing Git commands more intuitive, even when you’re dealing with advanced options.

Lazygit: A Terminal User Interface for Git

Imagine GitHub Desktop, but optimized for the terminal

Lazygit is crafted to streamline your everyday interactions with Git. While the standard command-line interface for Git is powerful, it can also be overwhelming due to its complexity. Most users only utilize a fraction of its numerous features, making it difficult to recall those less frequent yet crucial commands, such as bisect or stash.

Similar to other contemporary command-line applications, Lazygit employs a multi-line text interface that mimics a graphical user interface (GUI). This offers a balanced solution between the simplicity of command-line prompts and the fully mouse-driven interfaces of GUI tools like GitKraken and SourceTree. If you’re accustomed to the layout of GitHub Desktop, you will feel right at home with Lazygit.

With Lazygit, you can perform essential tasks—such as stashing, committing, switching branches, and checking out new worktrees—using just your keyboard. Although basic mouse support is available, its keyboard interface enables faster navigation.

Installing and Using Lazygit

Quick and Easy Installation

To install Lazygit, simply use your system’s package manager: for Debian/Ubuntu, run sudo apt install lazygit or brew install lazygit on macOS. Numerous other package managers are compatible, so refer to the project’s README for more installation options.

After installation, just execute lazygit from within a directory that is already a Git repository. The interface will appear as shown below:

A textual interface displaying multiple panels including 'Status,' 'Local branches,' and 'Commits'.

Lazygit features a flexible layout, allowing you to resize your terminal window, which will automatically adjust the individual panels accordingly.

Each primary panel is marked with a number from 0 to 5, enabling you to access them easily by pressing the corresponding key. Some panels may contain different tabs, and you can switch between these tabs using [ (left bracket) and ] (right bracket).

Lazygit supports multiple layouts for customizing what information you focus on. Pressing + allows you to cycle through different layouts while keeping the active panel in view. For instance, you can expand the third panel to showcase tags in a two-column layout, with the tag listing on one side and its details on the other:

An interface showing two columns; one with tag names and the other with details about each tag.

Pressing + once more will expand to a single, comprehensive panel displaying all tags:

A single-panel interface featuring a detailed list of tags and their descriptions.

In this view, you can still press 0 to return to the detail panel or use the shortcuts for other panels as needed. This versatility allows you to adapt Lazygit to your workflow effortlessly, much like using a tiling window manager.

Notable Features of Lazygit

Transition Made Simple

Lazygit incorporates robust mouse support. You can interact by simply clicking on elements, allowing smooth panel transitions, item selection, and scrolling through lengthy lists. A mouse click can also access persistent donation or support links found at the bottom of the app.

The commit graph in Lazygit gives a clear visual representation of branches and merges using straightforward line graphics. It similarly color-codes the information by author, which facilitates tracking contributions:

A representation of commit history including IDs, dates, authors, along with a commit graph.

Lazygit also provides text boxes for entering commit messages. However, it offers the option to switch to your preferred text editor for a more feature-rich experience:

A dialog box enabling the option to 'Open in editor' for commit summary.

This feature also allows you to edit files directly within Lazygit, providing a makeshift integrated development environment (IDE).

A particularly beneficial aspect of Lazygit is its selective staging functionality. This is invaluable for those who frequently make multiple changes in a single file. It allows you to pick relevant changes to stage while temporarily setting aside others. Here’s how to do it easily:

  • Select the desired file in the Files panel and press Enter to focus on the “Unstaged changes” section.
  • Use the arrow keys to choose individual lines and stage them using the spacebar.
  • Press a to stage entire hunks, followed by Space.
  • Once satisfied, hit Escape to return to the Files panel, then press c to commit.
The 'Unstaged changes' panel showing the ability to stage specific lines.

Embrace the Journey

Learning the keyboard shortcuts for Lazygit may require some time and practice, but help is always nearby. Beginners will likely find it far more approachable than Git’s less intuitive command-line options, while seasoned users will appreciate the efficiency gains in routine tasks.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button