Skip to content

Instantly share code, notes, and snippets.

@mdwhatcott
Last active October 5, 2019 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mdwhatcott/90a5ff084384ff7a9663c00a9e0cf1b7 to your computer and use it in GitHub Desktop.
Save mdwhatcott/90a5ff084384ff7a9663c00a9e0cf1b7 to your computer and use it in GitHub Desktop.
test && commit || revert (a la Kent Beck)
#!/usr/bin/env bash
# TCR: test && commit || revert
# codified by Kent Beck
# https://medium.com/@kentbeck_7670/test-commit-revert-870bbd756864
function test() {
echo
cd `git rev-parse --show-toplevel`
go test ./...
}
function commit() {
echo
git add .
git commit -m "tcr"
}
function revert() {
echo
git reset --hard
}
test && commit || revert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment