diff --git a/configs/.zshrc b/configs/.zshrc index 19b2fe9..001c0d8 100644 --- a/configs/.zshrc +++ b/configs/.zshrc @@ -68,6 +68,8 @@ fi # For wsl stay in the current dir when splitting panes? export PROMPT_COMMAND='printf "\e]9;9;%s\e\\" "$(wslpath -m "$PWD")"' +source $HOME/.dotfiles/configs/zsh/update-repo.zsh + # The next line updates PATH for the Google Cloud SDK. #if [ -f '/home/coder/downloads/google-cloud-sdk/path.zsh.inc' ]; then . '/home/coder/downloads/google-cloud-sdk/path.zsh.inc'; fi diff --git a/configs/zsh/update-repo.zsh b/configs/zsh/update-repo.zsh new file mode 100644 index 0000000..affa459 --- /dev/null +++ b/configs/zsh/update-repo.zsh @@ -0,0 +1,15 @@ +if [ -d "~/.dotfiles" ]; then + + currentDir=$(pwd) + + VN=$(git describe --abbrev=7 HEAD 2>/dev/null) + + git update-index -q --refresh + CHANGED=$(git diff-index --name-only HEAD --) + if [ ! -z $CHANGED ]; then + cd ~/.dotfiles + git reset --hard origin/main + git pull origin main + zshu + fi +fi