Skip to main content

gitstat

About

(screenshot)

Usage: gitstat [OPTIONS] COMMAND [ARGS]...

  Succinctly display information about git repositories.

  Gitstat looks for unstaged changes, uncommitted changes,
  untracked/unignored files, unpushed commits, and whether a pull from
  upstream is required.

  Gitstat can maintain a list of repos about which it will report. Use
  "gitstat track" to add repo(s) to its list.

  If no paths to git repos are specified on the command line, gitstat will
  show information about the repos it is tracking.

  Run "gitstat COMMAND --help" for help about a specific command.

Options:
  --version  Show the version and exit.
  --help     Show this message and exit.

Commands:
  check*      Check repo(s).
  fetch       Fetch from origin.
  ignore      Ignore repo(s).
  is-tracked  Show whether one or more repos are tracked by gitstat.
  pull        Pull from origin (if no local changes).
  showclone   Show "git clone" commands needed to clone missing repos.
  track       Track repo(s).
  unignore    Un-ignore repo(s).
  untrack     Untrack repo(s).

Gitstat has been designed with being careful in mind. Gitstat makes no changes to git repos, except for the 'fetch' and 'pull' commands. (gitstat fetch simply runs git fetch, and gitstat pull will pull from origin only if there are no local changes and a pull is required.)

Requirements

  • Python 3.6+
  • git

Installation

pip install --user pygitstat

Quick start

Show information about a repository:

gitstat ~/myproject

Note that this is the same as:

gitstat check ~/myproject

("check" is the default command.)

You use ~/myproject all the time; let's tell gitstat to remember it:

gitstat track ~/myproject

Now when you run Gitstat with no parameters, it will include the status of ~/myproject.

Try editing/adding files in ~/myproject, and/or commit (but don't push) changes, and run Gitstat again:

gitstat

By default, Gitstat will only output repos with changes. To include repos that are up-to-date:

gitstat --all

Gitstat can fetch from origin:

gitstat fetch

Pull from origin:

gitstat pull

Gitstat will pull only if there are no local changes and if a pull from upstream is required. You can run gitstat fetch to fetch first.

Gitstat can do more. To get help with individual commands:

gitstat --help
gitstat check --help

Color customization

There are two config files, repos.conf which contains the list of all repos that Gitstat is tracking, and gitstat.conf which is used to configure Gitstat (currently it's just for colorization). The config files live under $XDG_CONFIG_HOME/gitstat/ (usually ~/.config/gitstat/).

You can run gitstat config to show the locations of the files and colorization options:

gitstat colors

# gitstat.conf

# Run "gitstat config" to show the "Status" list and the default colors.
# For each Status, a COLOR and STYLE can be specified.
# STYLES can be: bold, dim, italic, underline, flash, reverse
# COLORS can be:
#   - a 6-hex string  #123456
#   - an RGB tuple    (255, 0, 0)
#   - a name          red

[colors]
# UNTRACKED_COLOR = (255, 0, 0)
# UNTRACKED_STYLE = bold
# PULL_REQUIRED_COLOR = #00FF11
# UNCOMMITTED_COLOR = cyan

Tips & tricks

Using with scripts

Similar to git, gitstat --quiet prints no output (except on error), and returns 1 if there are changes, else 0.

Clone missing repos

If moving to a new computer, or sharing Gitstat's config between multiple computers, gitstat showclone can be used to output a list of git clone commands for any repos Gitstat is tracking, but do not exist on the filesystem. Then you can copy and paste the output to clone any missing repos.

Track every repo in your home directory

find ~/ -type d -name .git -exec gitstat track {} \;

(Gitstat is "smart" enough to know that the parent directory of a directory named .git is the actual repository.)

Are you tracking all the repos you want to track?

find ~/ -type d -name .git | xargs gitstat is-tracked --quiet-if-tracked

License

Copyright 2019-2021  John Begenisich

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

Metadata

Release files for pygitstat 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pygitstat 0.5.1
File Size Uploaded
pygitstat-0.5.1.tar.gz 25.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pygitstat 0.5.1
File Interpreter ABI Platform
pygitstat-0.5.1-py3-none-any.whl Python 3 none any Details

Total release size: 61.1 kB

Release files / pygitstat-0.5.1.tar.gz

Download URL pygitstat-0.5.1.tar.gz
Size 25.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6bc1118837eec4e880026ceb4d9d8c0470c6689245d1cd372a26d7b8961d6f9e
BLAKE2b-256 checksum
How to use checksums
c7653cf68a83de75a49d10d5249d66e5b60162ce1d2f8c3842591890ef926ac6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.11 CPython/3.9.7 Linux/5.10.62-1-lts

Release files / pygitstat-0.5.1-py3-none-any.whl

Download URL pygitstat-0.5.1-py3-none-any.whl
Size 36.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7eebe8733748fcddb6f92f33bb54bb3d945616870fedd9fe5ebbe26d645e9f3e
BLAKE2b-256 checksum
How to use checksums
d8c4a90342fa0a18301ef2cc6b3e9e5a1cc77fda0128e1d7a7b391521c9f7a98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.11 CPython/3.9.7 Linux/5.10.62-1-lts

Release history Release notifications | RSS feed

This release

0.5.1 This release

2 release files

0.5.0

2 release files

0.4.8

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page