1
0

fix: improve dotpull alias and enhance stow installation script with better error handling

This commit is contained in:
2025-08-03 17:12:47 -05:00
parent 4cc4f2347e
commit 7bb8a3077c
2 changed files with 7 additions and 4 deletions

View File

@@ -7,7 +7,7 @@ alias h='history'
alias grep='grep --color=auto'
alias d='docker'
alias dc='docker compose'
alias dotpull='echo "🔄 Updating dotfiles..." && git -C ~/.dotfiles pull && echo "🔗 Re-stowing dotfiles..." && (cd ~ && stow -R .dotfiles) && echo "✅ Done."'
alias dotpull='echo "🔄 Updating dotfiles..." && git -C ~/.dotfiles pull && echo "🔗 Re-stowing dotfiles..." && cd ~ && (stow --adopt .dotfiles 2>/dev/null || stow -R .dotfiles) && echo "✅ Done."'
alias reloadbash='source ~/.bashrc && echo "Bash config reloaded."'

View File

@@ -25,7 +25,7 @@ fi
# Change to parent directory of dotfiles for stow to work correctly
cd "$HOME"
# Backup existing files that would conflict with stow
# Backup existing files that would conflict with stow (excluding SSH config - it's machine-specific)
for file in .bashrc .bash_aliases .inputrc .gitconfig; do
if [ -f "$HOME/$file" ] && [ ! -L "$HOME/$file" ]; then
echo "⚠️ Backing up existing file: $HOME/$file -> $HOME/${file}.bak"
@@ -33,9 +33,12 @@ for file in .bashrc .bash_aliases .inputrc .gitconfig; do
fi
done
# Use stow to create symlinks
# Use stow to create symlinks with --adopt to handle existing symlinks gracefully
echo "🔗 Using Stow to symlink dotfiles..."
stow -d "$HOME" -t "$HOME" .dotfiles
if ! stow --adopt .dotfiles 2>/dev/null; then
echo "🔄 Adopting failed, trying regular stow..."
stow .dotfiles
fi
# Optionally source the new bashrc
if [[ $- == *i* ]]; then