Last active
May 6, 2020 14:31
-
-
Save stefanofiorentino/3993cdaa213c782e4affa2d99c6c5be5 to your computer and use it in GitHub Desktop.
git hard reset from repo.log from git-repos
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PREVPWD=${PWD} | |
echo "Current Directory -> " ${PREVPWD} | |
while IFS= read -r line | |
do | |
command=$(echo "$line" | awk 'BEGIN { FS = " " } ; {print "cd \""$2"\" && git reset --hard "$8}') | |
if eval "${command}"; then | |
echo "${command}" | |
else | |
echo "ERROR: ${command}" | |
cd ${PREVPWD} | |
return 1 | |
fi | |
done < "$@" | |
echo "Going back to -> " ${PREVPWD} | |
cd ${PREVPWD} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment