Skip to content

Commit ab9f55e

Browse files
author
root
committed
Useful revert script
1 parent 17d5307 commit ab9f55e

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

sipxecs-revert

+13-2
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,21 @@ function checkUser()
1919

2020
}
2121

22+
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
2223
REVERT_TO_TAG=$@
2324

2425
git checkout ${REVERT_TO_TAG}
25-
mkdir ../${REVERT_TO_TAG}
26+
ERROR=$?
27+
if [ ${ERROR} -ne 0 ]; then
28+
echo "git checkout error, exiting sipxecs-revert"
29+
exit ${ERROR}
30+
fi
31+
mkdir -p ../${REVERT_TO_TAG}
2632
cp -r . ../${REVERT_TO_TAG}
27-
git checkout
33+
git checkout ${CURRENT_BRANCH}
34+
ERROR=$?
35+
if [ ${ERROR} -ne 0 ]; then
36+
echo "git checkout error, exiting sipxecs-revert"
37+
exit ${ERROR}
38+
fi
2839
\cp -rf ../${REVERT_TO_TAG}/* .

0 commit comments

Comments
 (0)