26 Aug 2015

djwong: (Default)
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:
$ 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

Profile

djwong: (Default)
Bogus J. Simpson

May 2016

S M T W T F S
1234567
891011121314
15161718192021
2223242526 2728
293031    

Style Credit

Expand Cut Tags

No cut tags
Page generated 25 Aug 2025 15:41
Powered by Dreamwidth Studios