]> git.phdru.name Git - git-scripts.git/blob - fork
Test status only in repos with worktrees
[git-scripts.git] / fork
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 local_repo="`basename \"$origin\" .git`"
11
12 git clone -o upstream "$upstream" "$local_repo" &&
13 cd "$local_repo" &&
14 git remote add origin "$origin" &&
15
16 chmod a-x .git/config &&
17 branch="`git branch | awk '/^\*/ {print $2}'`" &&
18
19 git pull origin $branch &&
20 git push -u origin &&
21
22 git config branch.$branch.remote upstream &&
23 git config branch.$branch.remotepush origin &&
24 git config branch.$branch.merge refs/heads/$branch &&
25 git config push.default current &&
26
27 git gc --aggressive &&
28 exec pwd >> "`dirname \"$0\"`"/locate-all.list