Add an option to "sync" = "stash; pull --rebase; push; pop stash"

This commit is contained in:
Adam Goldsmith 2019-01-15 21:46:37 -05:00
parent a369e45d8d
commit c5ded1e9f7

19
dup
View File

@ -20,6 +20,16 @@ function do_get() {
fi
}
function do_pull() {
if [ "$stashAndSync" = true ]
then
git stash
git pull --rebase
git push
git stash pop || true
fi
}
function run_script() {
script="$1"; shift
targets="$@"
@ -45,6 +55,7 @@ function maybe_stow() {
stow=true
bootstrap=false
stashAndSync=false
while [ "$#" -gt 0 ]
do
case $1 in
@ -56,6 +67,10 @@ do
bootstrap=true
shift
;;
-s | --stash-and-sync)
stashAndSync=true
shift
;;
--)
shift
break
@ -90,13 +105,13 @@ then
elif [ "$bootstrap" != true ]
then
echo "Updating .dotfiles"
git pull
do_pull
for dir in */
do
echo "Updating $dir"
cd "$dir"
git pull
do_pull
cd ..
done