rationalizing repository downstream flow control
[feisty_meow.git] / scripts / rev_control / push_repo_downstream.sh
1 #!/bin/bash
2
3 # this script works on a specialized type of git checkout that has been configured
4 # to push to a "downstream" repository, while still pulling from its normal origin.
5 # the downstream destination might be a github or sourceforge repository that is
6 # loaded from a personal repository or server.
7 #
8 # to set up the repository for relaying downstream, just do the normal checkout
9 # or clone on it from the real origin.  for example:
10 #
11 # $ git clone git://feistymeow.org/feisty_meow
12 #
13 # and then add the downstream remote repository:
14 #
15 # $ git remote add downstream https://github.com/fredhamster/feisty_meow.git
16 #
17 # once the repository has been created, you can synch all updates that
18 # have been checked into the origin repository with the downstream version
19 # by running this command:
20 #
21 # push_repo_downstream ~/relay_repo_folder
22
23 #hmmm: make this support multiple dirs?
24
25 dir="$1"; shift
26 if [ -z "$dir" ]; then
27   dir=.
28 fi
29
30 pushd "$dir"
31
32 # get everything from the origin.
33 git pull
34
35 # get everything from the origin.
36 git pull
37
38 # turn off occasionally troublesome setting before checkin.
39 unset GIT_SSH
40
41 # send the little boat down the stream to the dependent repository.
42 git push origin master <"$PASSWORD_FILE"
43
44 popd
45
46