]> git.phdru.name Git - git-scripts.git/blob - fork-existing
Add fork-existing
[git-scripts.git] / fork-existing
1 #! /bin/sh
2
3 if [ -z "$2" ]; then
4    echo "Usage: $0 upstream origin" >&2
5    exit 1
6 fi
7
8 upstream="$1"
9 origin="$2"
10
11 pwd >> "`dirname \"$0\"`"/locate-all.list &&
12 git remote add upstream "$upstream" &&
13 git remote set-url origin "$origin" &&
14
15 chmod a-x .git/config &&
16 branch="`git branch | awk '/^\*/ {print $2}'`" &&
17
18 git pull origin $branch &&
19 git push -u origin &&
20
21 git config branch.$branch.remote upstream &&
22 git config branch.$branch.remotepush origin &&
23 git config branch.$branch.merge refs/heads/$branch &&
24 git config push.default current &&
25
26 exec git gc --aggressive