set up gnu stow
This commit is contained in:
parent
bb2ac653de
commit
7818a929c8
2 changed files with 44 additions and 0 deletions
36
.local/bin/dotsync
Executable file
36
.local/bin/dotsync
Executable file
|
@ -0,0 +1,36 @@
|
|||
#!/bin/sh
|
||||
|
||||
GREEN='\033[1;32m'
|
||||
BLUE='\033[1;34m'
|
||||
RED='\033[1;30m'
|
||||
NC='\033[0m'
|
||||
|
||||
cd $HOME/.dotfiles
|
||||
|
||||
echo -e "${BLUE}Stashing existing changes...${NC}"
|
||||
stash_result=$(git stash push -m "sync-dotfiles: Before syncing dotfiles")
|
||||
needs_pop=1
|
||||
if [ "$stash_result" = "No local changes to save" ]; then
|
||||
needs_pop=0
|
||||
fi
|
||||
|
||||
echo -e "${BLUE}Pulling updates from dotfiles repo...${NC}"
|
||||
echo
|
||||
git pull origin main
|
||||
echo
|
||||
|
||||
if [[ $needs_pop -eq 1 ]]; then
|
||||
echo -e "${BLUE}Popping stashed changes...${NC}"
|
||||
echo
|
||||
git stash pop
|
||||
fi
|
||||
|
||||
unmerged_files=$(git diff --name-only --diff-filter=U)
|
||||
if [[ ! -z $unmerged_files ]]; then
|
||||
echo -e "${RED}The following files have merge conflicts after popping the stash:${NC}"
|
||||
echo
|
||||
printf %"s\n" $unmerged_files
|
||||
else
|
||||
stow -t $HOME .
|
||||
fi
|
||||
|
8
.stow-local-ignore
Normal file
8
.stow-local-ignore
Normal file
|
@ -0,0 +1,8 @@
|
|||
TODO
|
||||
\.git
|
||||
\.gitignore
|
||||
\.gitmodules
|
||||
\.cache/zsh/history
|
||||
\.local/share/virtualenv/\.keep
|
||||
\.config/X11/xsession\.d/40display-setup
|
||||
\.config/X11/xsession\.d/99extra-setup
|
Loading…
Add table
Reference in a new issue