Use case: Somewhere across the Internet is a git repo that we want to cache locally. We should be able to clone this cache-repo to do our development work, but the bare repo should only ever pull from its upstream. The flow looks like this: upstream repo <-- bare cache repo <-- work repo.
First, set up the bare repo:
Next, tell git that we want to fetch all heads.
Check out the working copy.
Create a remote tracking branch.
Initialize stgit.
First, set up the bare repo:
$ git clone --bare git://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git e2fsprogs.git
Next, tell git that we want to fetch all heads.
$ cd e2fsprogs.git
$ git config remote.origin.fetch 'refs/heads/*:refs/heads/*'
Check out the working copy.
$ cd ..
$ git clone -l -s e2fsprogs.git e2fsprogs
Create a remote tracking branch.
$ cd e2fsprogs
$ git branch --track for-next origin/for-next
$ git checkout for-next
Initialize stgit.
$ stg init