Joined May 2013
·

Yawar Amin

Ontario, Canada
·
·

Posted to Backup all modified files in git. over 1 year ago

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.

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