DEV Community

suin
suin

Posted on

git-remind: Do you forget to git commit/git push?

Do you forget to git commit or git push? git-remind is a command line tool for such a forgetful person (like me). It monitors the state of the Git repositories and reports which repositories need to commit or push.

Features

git-commit/git-push status

git-remind checks across the all git repositories in your computer, and it displays the status whether there are uncommitted files and there are ahead commits which should be pushed to remote.

Desktop Notification

git-remind notifies you git-commit/git-push status using desktop notification. This feature is tested macOS, but it will work in Windows and Linux.

Installation

Homebrew

brew install suin/suin/git-remind

Manually

Download build binary from the releases.

Configuration

Add remind.paths to your .gitconfig, using your own absolute path to the repository directories.

[remind]
    paths = /Users/you/projects/foo,/Users/you/projects/bar

If you have some git repositories (e.g. ~/projects/foo and ~/projects/bar) in the same directory (e.g. in ~/projects) , you may specify the path using wildcard (e.g./Users/you/projects/*):

[remind]
    paths = /Users/you/projects/*

Check the configuration using the following command:

git-remind paths # Shows path patterns configuration
git-remind repos # Shows git repositories to be reminded

Usage

Display git-commit/git-push status

$ git-remind status
Need to commit: /Users/suin/projects/myapp1
Need to commit and push: /Users/suin/projects/myapp2

Short status like git status -s

$ git-remind status -s
C  /Users/suin/projects/myapp1
CP /Users/suin/projects/myapp2

Show all status including up-to-date repositories

$ git-remind status -a
Need to commit: /Users/suin/projects/myapp1
Need to commit and push: /Users/suin/projects/myapp2
Up-to-date: /Users/suin/projects/myapp3

Desktop Notification

git-remind status-notification

Advanced usage

Scheduled reminder (cron)

To get scheduled reminder, set up crontab. Following example send notifications every 20 minutes:

PATH=/usr/local/bin:/usr/bin:/bin

*/20 * * * * git-remind status-notification > /dev/null 2>&1

Jumping to the repositories

By combining git-remind and fzf, you will be able to jump the repositories that needs to commit or push:

cd $(git remind status -n | fzf)

It would be useful that you set command alias in your .bashrc/.zshrc:

alias grj='cd $(git remind status -n | fzf)'

Reference

Oldest comments (7)

Collapse
 
tux0r profile image
tux0r

This makes no sense unless you only have your own code on your computer. In my case, roughly 10 of 11 (?) Git repositories are clones of other people's code - and keeping an eye on the last one is relatively easy.

Do you have a specific use case for a whole bunch of "dirty" Git repositories which all need to be kept up-to-date by you at the same time?

Collapse
 
alevinetx profile image
alevinetx

I usually have a good 10 repos going at any point in time, often swapping branches, too. I can't speak to the usefulness of this tool, yet, but I'm definitely intrigued.

Collapse
 
rouzbeh84 profile image
rouzbeh

why wouldn't you be able to use it with a forked or cloned repo? are you always committing your gitconfig? are you not downloading the repos locally to work on them? not sure i understand what you mean

Collapse
 
abhijitparida profile image
Abhijit Parida

Don't people follow the "commit often, commit early" rule anymore? And just push when they are done with their changes?

Collapse
 
jenbutondevto profile image
Jen • Edited

This is a cool project. I should send this to my colleague who always claims “I’ve pushed to x branch” and not actually push to origin. Although, I suspect that’s because of his stubborness and refusing to use a git gui like sourcetree since I don’t have that problem. ¯_(ツ)_/¯

Collapse
 
mmphego profile image
Mpho Mphego

Can it be ported to Python?

Collapse
 
steven_carr_b59385fce681 profile image
Steven Carré

good idea. a feature that I could use: after each commit, a reminder, like "don't forget to run cscheck" for instance. That would definitely get me onboard