20 lines
343 B
Bash
Executable File
20 lines
343 B
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# Unstage a branch
|
|
|
|
set -e
|
|
|
|
branch=$(git rev-parse --abbrev-ref HEAD)
|
|
|
|
if [ -z "$1" ]; then
|
|
basebranch="master"
|
|
else
|
|
basebranch="$1"
|
|
fi
|
|
|
|
diff=$(git diff $basebranch...HEAD)
|
|
git co -q "$basebranch"
|
|
echo "$diff" | git apply
|
|
echo "Unstaged $branch against $basebranch successfully"
|
|
git diff --shortstat "HEAD...$branch"
|