mirror of
https://github.com/tj/git-extras.git
synced 2026-09-10 07:26:17 -04:00
Wiping out previous commits is error prone. Most people probably want to edit their changes and commit again. Modified behavior so that when undoing a commit, changes are left in the user directory unstaged.
14 lines
214 B
Bash
Executable file
14 lines
214 B
Bash
Executable file
#!/bin/sh
|
|
|
|
if test $# -eq 0; then
|
|
git reset --soft HEAD~1
|
|
git reset
|
|
else
|
|
if `echo $1 | grep -q [^[:digit:]]`; then
|
|
echo "$1 is not a number" 1>&2
|
|
else
|
|
git reset --soft HEAD~$1
|
|
git reset
|
|
fi
|
|
fi
|