Git Product home page Git Product logo

git-forgot's Introduction

:::非推奨:::

このプロジェクトは非推奨です。https://github.com/suin/git-remind を代わりに使ってください。

git forgot

git add したが commit を忘れていた。コミット漏れがあって同僚に迷惑をかけた。複数のリポジトリを同時に触っていたら、片方のリポジトリをpushするのを忘れてしまった。gitを使ったことがあれば、このような失敗をしたことがあるのではないだろうか?

忘れることは人間である以上しかたない。であれば、思い出させてくれる何かがあればいい。例えば、通知センターでコミット漏れを教えてくれるだけでも十分だ。

Screen Shot 2014-08-25 at 11.12.22.png

そこで、今回作ったツールがgit-forgot。このツールは、git forgotと打つとpushやcommitがされてないリポジトリを教えてくれるものだ。

2__Shell.png

この記事では、git-forgtについて紹介したい。

インストール方法

インストールはMacであればHomebrewでできる。

brew tap suin/suin
brew install git-forgot

LinuxやWindowsはダウンロードコーナーにバイナリを配布しているのでダウンロードしてほしい。

セットアップ

git-forgotでチェックしたいディレクトリを環境変数 GIT_FORGOT_DIR に設定しておく必要がある。複数またはアスタリスクで指定できる。.gitがあるディレクトリのみチェックされるので、関係ないディレクトリが含まれていても構わない。

export GIT_FORGOT_DIR="$HOME/projects/* $HOME/github/*"

使い方

セットアップが完了したら、あとはコマンドを叩くだけでチェックできるようになる。コミット漏れやプッシュ忘れがあるリポジトリがあれば、そのパスが出る。問題なければ何も出ない。

$ git-forgot

なお、gitのサブコマンドとしても使える。

$ git forgot

リポーター(--reporter, -r)を指定すれば、通知センターに通知を送ることもできる。通知にはterminal-notifierが必要なので、インストールしておいて欲しい。

$ git forgot --reporter terminal-notifier

また、git forgot -r terminal-notifier -t iTerm のようにコンソールを-tで渡すと、通知センターの通知をクリックしたときに、該当プロジェクトを開けるようになる(m0aさん提供)。

crontabにしこんでおけば、定期的にコミット漏れなどをチェックし、通知センターで通知を受け取ることができる。

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

*/20 * * * * git-forgot -r terminal-notifier $HOME/projects/* $HOME/github/* > /dev/null 2>&1

pecoと組み合わせても便利。

alias gf='arr=(`git-forgot|peco`) && cd $arr[1]'

その他のオプションについては -h でヘルプを見れる。

$ git forgot -h

git-forgot's People

Contributors

m0a avatar suin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.