From 8d25606414b27ab1eb62c71d4547466e2a9fd82e Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Tue, 14 Jul 2020 22:33:28 +0100 Subject: [PATCH] Add Update-Dotfiles command --- bin/bin/{pull-dotfiles => update-dotfiles} | 4 ++-- posh/Microsoft.PowerShell_profile.ps1 | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) rename bin/bin/{pull-dotfiles => update-dotfiles} (69%) mode change 100755 => 100644 diff --git a/bin/bin/pull-dotfiles b/bin/bin/update-dotfiles old mode 100755 new mode 100644 similarity index 69% rename from bin/bin/pull-dotfiles rename to bin/bin/update-dotfiles index d0f9858..2d22b3a --- a/bin/bin/pull-dotfiles +++ b/bin/bin/update-dotfiles @@ -2,9 +2,9 @@ if [ -d "${HOME}/.dotfiles" ]; then cd $HOME/.dotfiles - git reset --hard && git pull + git pull --rebase --autostash fi if [ -d "${HOME}/.dotfiles-private" ]; then cd $HOME/.dotfiles-private - git reset --hard && git pull + git pull --rebase --autostash fi \ No newline at end of file diff --git a/posh/Microsoft.PowerShell_profile.ps1 b/posh/Microsoft.PowerShell_profile.ps1 index a743af7..4590196 100644 --- a/posh/Microsoft.PowerShell_profile.ps1 +++ b/posh/Microsoft.PowerShell_profile.ps1 @@ -14,6 +14,12 @@ function Add-SshKey { } } +function Update-Dotfiles { + Join-Path $HOME '.dotfiles' | Push-Location + Invoke-Expression -Command "git pull --rebase --autostash" + Pop-Location +} + $DotFilesPath = Join-Path $HOME '.dotfiles' $DotFilesAutodetect = $true $DotFilesAllowNestedSymlinks = $true