commit c5b7131ff829e22590f6f2b5bd6dfaa13e036eb7
parent 7a5170f0fef394585d5a699b9d8f1cfb01b407df
Author: Nihal Jere <nihal@nihaljere.xyz>
Date: Tue, 11 Jan 2022 20:12:19 -0600
perform `git reset --hard HEAD` and warn changes will be lost
Diffstat:
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
@@ -39,5 +39,4 @@ to be placed and run
$ $GSI $CHILD $DEST
```
-Of course
Depending on the size of your repo and commits, it may take a while.
diff --git a/git-submodule-integrate b/git-submodule-integrate
@@ -1,10 +1,20 @@
#!/bin/sh
[ $# -ne 2 ] && {
- printf "usage: $0 what where" 1>&2
+ printf "usage: $0 path_to_child subdir_in_parent" 1>&2
exit 1
}
+if git diff-files --quiet || git diff-index --quiet --cached HEAD --
+then
+ printf "Changes in the index or working tree will be lost. Continue? [y/n]: "
+ read yn
+ case $yn in
+ [Yy]*) ;;
+ *) printf "No changes were made\n"; exit 1 ;;
+ esac
+fi
+
child="$1"
where="$2"
@@ -51,3 +61,5 @@ do
finished=$(( finished + 1 ))
printf "%s/%s finished\n" "$finished" "$total"
done
+
+git reset --hard HEAD