Home Command line utilities Display Git Repository Summary In Terminal Using Onefetch
How To Display Git Repository Summary In Terminal Using Onefetch

Display Git Repository Summary In Terminal Using Onefetch

By sk

Git is a distributed revision control system developed in 2005 by Linus Torvalds for development of the Linux Kernel. Git allows a user to track changes in source code during software development. There are millions of Git repositories hosted in GitHub, GitLab and other version control repository hosting services. In this guide, we will see how to display a Git repository summary in Terminal using Onefetch.

Onefetch is a command line tool to get a Git repository's information right from the terminal. It displays various details of a given Git repository as listed below:

  • Project name,
  • HEAD,
  • Project's version,
  • The year of the project creation,
  • Name of the programming languages that are used to create this project,
  • Name of the authors and their contribution level in percentage,
  • When the repository is last changed,
  • The URL to the repository,
  • Total number of commits,
  • Total lines of code,
  • The size of the repository,
  • Project license.

Onefetch displays all of the aforementioned details along with the dominant programming language's ASCII logo. You can, of course, change the ASCII logo with your own or text input or nothing at all. Onefetch is fully customizable. You can configure it using command line flags to display exactly what you want and the way you want it to. For instance, you can decide which language's ASCII logo to print, disable a specific detail from the output, change the ASCII art color, and change the text color etc.

Onefetch supports more than 50 programming languages at the time of writing this guide. If you think a specific language is missing, just open an issue in GitHub and the support might be added.

It is an open source project written in Rust programming language. The source code of Onefetch is freely available in GitHub under MIT license.

Install Onefetch in Linux

Onefetch can be installed in multiple ways.

Download the Onefetch binary from the releases page:

$ wget https://github.com/o2sh/onefetch/releases/download/v2.5.0/onefetch-linux.tar.gz

Extract the downloaded archive and move it to your $PATH like below:

$ sudo mv onefetch-linux/onefetch /usr/local/bin/

Onefetch is also available in AUR, so you can install Onefetch on Arch Linux and its variants using any AUR helper tools, for example Yay, like below:

$ yay -S onefetch

To install Onefetch on NixOS, run:

$ nix-env -i onefetch

On openSUSE Leap and Tumbleweed:

$ sudo zypper install onefetch

Display Git Repository Summary In Terminal Using Onefetch

For the purpose of this guide I am going to fetch the details of Onefetch Git repository itself. I have cloned the Onefetch repository in my Desktop.

To display Git repository summary in Terminal, either directly mention path of the repository like below;

$ onefetch Desktop/onefetch/

Or go to the Git repository and run onefetch:

$ onefetch

Sample output:

                 R RR RR                  ostechnix ~ git version 2.25.1
              RRRRRRRRRR R                ------------------------------
            R RRRRRRRRRRRRRRR             Project: onefetch (19 branches, 18 tags)
            RRRRRRRRRRRRRRRRR       R     HEAD: c133f7a (master, origin/master)
 R RR    RRRRRRRRRRRRRRRRRRRRRR    RR     Version: v2.5.0
rR RRR    RRRRRRRRRRRRRRRRRRRRR   RRR R   Created: 2 years, 2 months ago
RRR RR  RRRRRRRRRRRRRRRRRRRRRRRRR RRRRR   Languages: Rust (95.9 %) Python (3.1 %) 
    R  RRRRRRRRRR=  RR = RRRRRRRRRRR               5% dependabot[bot] 50
     RRRRRRRRRRRr=  RR = RRRRRRRRRR                5% Spenser Black 49
      RRRRRRRRRRR   RR   RRRRRRRRRR       Last change: 11 hours ago
     RR==RRRRRRRRRRRRRRRRRRRRRR===RR      Repo: https://github.com/o2sh/onefetch.git
     RR = .==RRRRRRR  RRRRRR==  = Rr      Commits: 855
      RR =     ===========     = RR       Lines of code: 2360
       RR                        R        Size: 12.27 MiB (97 files)
        R                       R         License: MIT
Display Git Repository Summary In Terminal Using Onefetch
Display Git Repository Summary In Terminal Using Onefetch

As you can see in the above output, Oefetch displays the code distribution, top contributors (by number of commits), repository size,, creation date, version, HEAD, last change, total no lines of code, and license etc.

As stated already, Onefetch displays dominant language's ASCII art in the output. Since the major part of Onefetch is developed in Rust, it shows the Rust language's ASCII art. You can also use some other language's ASCII using -a, --ascii-language flag. The following command displays the Onefetch Git repository summary alongside Python ASCII logo:

$ onefetch -a python

Please note that I am running Onefetch from inside of the git repository. If your repository is stored somewhere else, you must specify its full path and then the flags.

Sample output:

             :::::::::::::                 ostechnix ~ git version 2.25.1
           ::::::::::::::::::              ------------------------------
          :::   ::::::::::::::             Project: onefetch (19 branches, 18 tags)
          ::::::::::::::::::::             HEAD: c133f7a (master, origin/master)
                    ::::::::::             Version: v2.5.0
    :::::::::::::::::::::::::: ______      Created: 2 years, 2 months ago
  :::::::::::::::::::::::::::: ________    Languages: Rust (95.9 %) Python (3.1 %) 
 ::::::::::::::::::::::::::::: _________              Nix (1.1 %) 
:::::::::::::::::::::::::::::  _________   Authors: 57% o2sh 488
::::::::::::::::::::::::::    __________            5% dependabot[bot] 50
:::::::::::  ___________________________            5% Spenser Black 49
:::::::::  _____________________________   Last change: 12 hours ago
 :::::::: _____________________________    Repo: https://github.com/o2sh/onefetch.git
 :::::::: _____________________________    Commits: 855
   :::::: __________________________       Lines of code: 2360
          ____________________             Size: 12.27 MiB (97 files)
          ____________________             License: MIT
          ______________   ___             
Get Git repository summary using onefetch with different language ASCII art
Get Git repository summary using onefetch with different language ASCII art

To list all supported languages, use -l, --languages flag.

$ onefetch -l

You can also use custom image, for example your own logo using -i, --image flag.

$ onefetch -i ~/ostechnix.png
Display git repository summary in terminal using onefetch with custom ASCII art
Display git repository summary in terminal using onefetch with custom ASCII art

By default, Onefetch will display three authors only. Several authors may contribute to a Git project. To display number of authors to be shown, use -A, --authors-number flag.

$ onefetch -A 10

The above command will show 10 authors.

There are many other flags to do various customizations such as change ascii colors, text colors, color resolution, ignore merge commits, exclude files, folders, and more. Refer the help section to learn all available options:

$ onefetch -h

Onefetch help section:

onefetch 2.5.0
Git repository summary on your terminal

    onefetch [OPTIONS] [--] [input]

    -a, --ascii-language <LANGUAGE>    Which LANGUAGE's ascii art to print.
    -d, --disable-fields <FIELD>...    Allows you to disable FIELD(s) from appearing in the output.
    -c, --ascii-colors <X>...          Colors (X X X...) to print the ascii art.
        --no-bold                      Turns off bold formatting.
    -l, --languages                    Prints out supported languages
    -i, --image <IMAGE>                Path to the IMAGE file
        --image-backend <BACKEND>      Which image BACKEND to use.
        --no-merge-commits             Ignores merge commits
        --no-color-blocks              Hides the color blocks
    -A, --authors-number <NUM>         NUM of authors to be shown. [default: 3]
    -e, --exclude <EXCLUDE>...         Ignore all files & directories matching EXCLUDE.
    -h, --help                         Prints help information
    -V, --version                      Prints version information

    <input>    Run as if onefetch was started in <input> instead of the current working directory.


Related read:

You May Also Like

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More