]> git.phdru.name Git - git-scripts.git/blob - update-remotes
Feat(submodules/remove): Add option `-c`
[git-scripts.git] / update-remotes
1 #! /bin/sh
2
3 current="`git config --get --path remote.current.url`"
4 origin="`git config --get --path remote.origin.url`"
5
6 if [ -n "$origin" ]; then
7    if [ -n "$current" ]; then
8       echo "Config error (both origin and current)" >&2
9       exit 1
10    else
11       cd "$origin" &&
12       exec ./update-remotes
13    fi
14 elif [ -z "$current" ]; then
15    echo "Wrong directory error (neither origin nor current)" >&2
16    exit 1
17 fi
18
19 git pull --ff-only current master &&
20
21 web="`git config --get --path remote.web.url`" &&
22 if [ -n "$web" ]; then
23    git push web
24 fi &&
25
26 cd "$current" && exec git pull origin