Add unstagebranch script
This commit is contained in:
parent
67a6e89e56
commit
59ee22ca6a
|
@ -0,0 +1,19 @@
|
|||
#!/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"
|
Loading…
Reference in New Issue