@@ 8,13 8,25 @@
checkout()
{
+ # The lock is left there even when nothing uses it...
+ # Of course in general this is dangerous, nothing else
+ # should be accessing the repo.
+ rm -rf .git/index.lock
+
+ if [[ ! -f $repo/.git/HEAD ]]; then
+ cd -
+ rm -rf $repo
+ fi
+
if git show-ref --verify --quiet refs/remotes/origin/main; then
- git checkout -b main origin/main
+ git checkout main
elif git show-ref --verify --quiet refs/remotes/origin/master; then
- git checkout -b master origin/master
+ git checkout master
else
echo "ERROR: No main or master branch found in $repo" >&2
fi
+
+ git reset --hard HEAD
}
for repo in ~/.emacs.d/stateful/elpaca/repos/*; do