1
0

fix: correct dotpull alias and improve stow installation script for better directory handling

This commit is contained in:
2025-08-03 17:30:01 -05:00
parent 7bb8a3077c
commit 087ffacfbd
2 changed files with 5 additions and 7 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 --adopt .dotfiles 2>/dev/null || stow -R .dotfiles) && echo "✅ Done."'
alias dotpull='echo "🔄 Updating dotfiles..." && git -C ~/.dotfiles pull && echo "🔗 Re-stowing dotfiles..." && (cd ~/.dotfiles && stow --adopt -t ~ . 2>/dev/null || stow -t ~ .) && echo "✅ Done."'
alias reloadbash='source ~/.bashrc && echo "Bash config reloaded."'

View File

@@ -22,9 +22,6 @@ else
git clone "$DOTFILES_REPO" "$DOTFILES_DIR"
fi
# Change to parent directory of dotfiles for stow to work correctly
cd "$HOME"
# 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
@@ -33,11 +30,12 @@ for file in .bashrc .bash_aliases .inputrc .gitconfig; do
fi
done
# Use stow to create symlinks with --adopt to handle existing symlinks gracefully
# Change to dotfiles directory and use stow to create symlinks
cd "$DOTFILES_DIR"
echo "🔗 Using Stow to symlink dotfiles..."
if ! stow --adopt .dotfiles 2>/dev/null; then
if ! stow --adopt -t "$HOME" . 2>/dev/null; then
echo "🔄 Adopting failed, trying regular stow..."
stow .dotfiles
stow -t "$HOME" .
fi
# Optionally source the new bashrc