Created
March 28, 2011 07:43
-
-
Save curtisharvey/890122 to your computer and use it in GitHub Desktop.
commit modified files using lines removed from TODO.md as commit message
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# commit modified files using lines removed from TODO.md as commit message | |
git ci -am "$(git diff "TODO.md" | awk '/^-\* / {printf substr($0, 4)"; "}')" | |
# make it easier by adding an alias to .gitconfig | |
[alias] | |
todone = "!git ci -am \"$(git diff \"TODO.md\" | awk '/^-\* / printf substr($0, 4)\"; \"}')" | |
# make it smarter by looking for the TODO.md file or accepting it as an argument | |
[alias] | |
todone = "!f () {\ | |
R=\"$(git rev-parse --git-dir 2> /dev/null)/..\";\ | |
if [[ \"$1\" && -f \"$1\" ]]; then T=\"$1\";\ | |
elif [[ -f \"TODO.md\" ]]; then T=\"TODO.md\";\ | |
elif [[ -f \"${R}/TODO.md\" ]]; then T=\"${R}/TODO.md\";\ | |
else echo \"TODO file not found, specify as first argument or use default name of TODO.md\"; exit;\ | |
fi;\ | |
m=\"$(git diff \"$T\" | awk '/^-\\* / {printf substr($0, 4)\"; \"}')\";\ | |
if [[ \"x$m\" != \"x\" ]]; then git ci -am \"$m\";\ | |
else echo \"[NOTICE] No lines removed from '$T'\";\ | |
fi;\ | |
}; f" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment