]> ruderich.org/simon Gitweb - config/dotfiles.git/blob - sync.sh
Remove an unnecessary check in sync.sh.
[config/dotfiles.git] / sync.sh
1 #!/bin/sh
2
3 # Syncs with remote hosts in the git (sub)directories.
4 #
5 # Allows fetching (no merge) and pushing at the moment.
6
7
8 # Select the method, fetch and push is possible.
9 if [ x$1 = x -o x$1 = xfetch -o x$1 = xfe ]; then
10     method=fetch
11 elif [ $1 = push -o $1 = pu ]; then
12     method=push
13 else
14     echo "Usage: sync.sh [fetch | fe | push | pu ]"
15     echo
16     echo "fetch: Fetch from all remotes."
17     echo "push: Push to all remotes."
18     exit 1
19 fi
20
21 # Fetch from/Push to each remote of each git subdirectory.
22 for project in `find . -name .git -type d`; do
23     pwd=`pwd`
24     cd "$project"
25
26     # Fetch from/Push to all remotes.
27     for remote in `git remote`; do
28         echo "$project: ${method}ing $remote ..."
29         git $method "$remote"
30     done
31
32     cd "$pwd"
33 done