about summary refs log tree commit diff stats
path: root/home-manager/packages/scripts/small_functions
diff options
context:
space:
mode:
Diffstat (limited to 'home-manager/packages/scripts/small_functions')
-rwxr-xr-xhome-manager/packages/scripts/small_functions/update.sh (renamed from home-manager/packages/scripts/small_functions/update)6
1 files changed, 4 insertions, 2 deletions
diff --git a/home-manager/packages/scripts/small_functions/update b/home-manager/packages/scripts/small_functions/update.sh
index 7b7b2e01..a8a838e8 100755
--- a/home-manager/packages/scripts/small_functions/update
+++ b/home-manager/packages/scripts/small_functions/update.sh
@@ -10,7 +10,8 @@ help() {
 EOF
     exit "$1";
 }
-
+tmp=$(mktmp);
+git remote show origin | grep 'HEAD' | cut -d':' -f2 | sed -e 's/^ *//g' -e 's/ *$//g' > $tmp &
 BRANCH="";
 
 while [ "$#" -gt 0 ];do
@@ -36,6 +37,7 @@ done
 
 
 cd /etc/nixos || die "No /etc/nixos"
-[ "$BRANCH" = "" ] || git switch "$BRANCH";
 git pull --rebase
+[ "$BRANCH" = "" ] || git switch "$BRANCH";
 nixos-rebuild switch
+git switch "$(cat $tmp)";