Merge pull request #43 from kennethreitz/feature/git-back

Added `git-back` command for soft undos [kennethreitz]
This commit is contained in:
TJ Holowaychuk 2011-06-17 07:53:16 -07:00
commit 0ce6d057ba
2 changed files with 49 additions and 0 deletions

11
bin/git-back Executable file
View file

@ -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

38
man/git-back.md Normal file
View file

@ -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 &lt;<me@kennethreitz.com>&gt;
## REPORTING BUGS
&lt;<http://github.com/visionmedia/git-extras/issues>&gt;
## SEE ALSO
&lt;<http://github.com/visionmedia/git-extras>&gt;