Joined May 2013
·
Posted to
Keep TODOs in git
over 1 year
ago
Apologies if I'm double-posting this. My previous comment seems to have been lost.
I've adopted a variant of your todo commit:
todo() {
git checkout -b $1
git commit --allow-empty -m "TODO: $2"
git checkout -
}
Usage:
todo fix-foobar "Fix foobar"
This creates a new branch 'fix-foobar' based on your current branch, switches to it, creates an empty commit with message 'Fix foobar', and switches back to your original branch.
In other words, it puts a todo commit in its own branch, out of the way of your regular work. If you then decide to fix foobar, you can checkout 'fix-foobar', commit as necessary, and do a simple rebase. The original empty commit will be automatically squashed out of existence.
So it's a natural way to create and defer working on feature branches.
Thanks for the original idea.
Achievements
78 Karma
0 Total ProTip Views
Forked
Have a project valued enough to be forked by someone else
Cub
Have at least one original jQuery or Prototype open source repo
Walrus
The walrus is no stranger to variety. Use at least 4 different languages throughout all your repos
Charity
Fork and commit to someone's open source project in need
Python
Would you expect anything less? Have at least one original repo where Python is the dominant language
T-Rex
Have at least one original repo where C is the dominant language
Lab 3
Have at least three original repos where C# is the dominant language
Lab
Have at least one original repo where C# is the dominant language
git stash - automatically stashes modifications and gets you back to a clean working directory
git stash pop - applies the saved modifications on top of your clean working directory
See the man page for more.