LoginSignup
10
5

More than 3 years have passed since last update.

git-todosはいいぞ

Last updated at Posted at 2020-07-30

みんなー!進行中のプロジェクトのTODOを管理するのに苦労してるー?
シンプルかつ合理的なツールを見つけたので紹介するよー!

これ -> git-todos
last commitが3 years agoでスター数54なのでもう誰もメンテしてない感あるけど、そのシンプルさゆえか問題なく使えました。

他にも見つかったものとして、ソース中のTODO FIXME的な文字列を検索してリスト化してくれるやつ(git-todo)もあったけど、僕の場合は以下の理由でTODOはソースとは別に管理したかったのでgit-todosの方を選びました。

  • TODOコメントを書く習慣がない
  • TODOコメントを書く時に、ツールを通したときにどう見えるのかを気にしたくない
  • TODOコメントをどのファイルのどの位置に置くのが適切かを考えたくない
  • TODOの消化とcommitを明示的に結びつけたい

個人とか小人数の小規模プロジェクトだとgit-todosの方が良い気がしたけど、ある程度大規模だともしかしたらgit-todoの方がぴったりハマるのかもしれない。
(名前ややこしいな)

以下git-todosの使い方紹介。

TODOの追加

git todos addを叩くと対話的にTODOが作成される。
ここで設定するTitleとDescriptionはそのまま、TODOを消化する時のコミットコメントのデフォルト値として使える。

$ git todos add
? Title (Required) create readme
? Description with very first greetings
✔ A Todo has been added
✔ You rock! 🚀

TODOの管理

.todos.ymlというファイルが生成され、そこにTODOのリストが記入される。
手動で変更しても良い。

todos:
- title: create readme
  description: with very first greetings
  marked: false
  id: 0
todos:
- title: add .gitignore
  description: to keep secrets secret
  marked: false
  id: 0

CLIからはgit todos listで表示できる。(なぜかアルファベット順になる。)

$ git todos list

1) add .gitignore
2) create readme

git todos showで個別のtodoを表示できる

$ git todos show
? Select an item (Use arrow keys) create readme

create readme

with very first greetings

TODOの消化

git todos finishを叩くと対話的にTODOを消化できる。
同時に、TODO追加時のtitledescriptionからメッセージを生成しつつgit commitもしてくれる。
つまり そのTODOに関係する内容のファイルをgit addしたあとに、git commitの代わりにgit todos finishを叩くといい感じということ。
必要があればGitHubのIssueの解決もしてくれるっぽい。

$ git todos finish
? Select an item (Use arrow keys) create readme
? Type of change that you're committing (Required) first import
? Denote the scope of this change readme
? Short description create readme
? Longer description of the change 
? List any issues closed by this change 
✔ Your work has been commited
✔ A Todo has been removed
✔ I see what you did there! 🙏

ちなみにその後のgit logはこんな感じ

commit a2ae4aee207a3b82bbaa83e218204e054dbe46d6 (HEAD -> master)
Author: nariakiiwatani <nariakiiwatani@annolab.com>
Date:   Thu Jul 30 23:19:49 2020 +0900

    first import(readme): create readme
10
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
5