diff --git a/bin/git-back b/bin/git-back new file mode 100755 index 0000000..300e016 --- /dev/null +++ b/bin/git-back @@ -0,0 +1,11 @@ +#!/bin/sh + +if test $# -eq 0; then + git reset --soft HEAD~1 +else + if `echo $1 | grep -q [^[:digit:]]`; then + echo $1 is not a number + else + git reset --soft HEAD~$1 + fi +fi \ No newline at end of file diff --git a/man/git-back.md b/man/git-back.md new file mode 100644 index 0000000..e681fba --- /dev/null +++ b/man/git-back.md @@ -0,0 +1,38 @@ +git-back(1) -- Undo and Stage latest commits +============================================ + +## SYNOPSIS + +`git-back` [<commitcount>] + +## DESCRIPTION + + Removes the latest commits, and add their changes to your staging area. + +## OPTIONS + + <commitcount> + + Number of commits to remove. Defaults to *1*, thus remove the latest commit. + +## EXAMPLES + + Removes the latest commit. + + $ git back + + Remove the latest 3 commits: + + $ git back 3 + +## AUTHOR + +Written by Kenneth Reitz <> + +## REPORTING BUGS + +<> + +## SEE ALSO + +<>