Saturday, March 30, 2013

Sharing LLVM and cilkplus LLVM in a single git clone

I want to track the development of both LLVM and cilkplus LLVM in git, but I don't want to have two git clones with essentially the same content. So I took advantage of the ability that git could pull from multiple remote repositories.

First I pull LLVM like this:
git clone http://llvm.org/git/llvm.git
git config branch.master.rebase true
And then heeding the advice to pull-push from multiple remote locations, I add cilkplus LLVM like this:
git remote add cilkplus git://github.com/cilkplus/llvm
git remote update
Now I have two remote branches, cilkplus/cilkplus and cilkplus/master as well as branches from origin.
$ git branch -r
  cilkplus/cilkplus
  cilkplus/master
  origin/HEAD -> origin/master
  origin/master
  origin/release_1
  origin/release_16
  origin/release_20
  origin/release_21
  origin/release_22
  origin/release_23
  origin/release_24
  origin/release_25
  origin/release_26
  origin/release_27
  origin/release_28
  origin/release_29
  origin/release_30
  origin/release_31
  origin/release_32
  origin/stable
  origin/testing
I could check them out directly either in the detached head state, or I could create a local branch to track it.
git branch --track cilkplus cilkplus/cilkplus
git checkout cilkplus
git pull
Now I end up with the list of branches like this:
$ git branch -a
* cilkplus
  master
  remotes/cilkplus/cilkplus
  remotes/cilkplus/master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master
  remotes/origin/release_1
  remotes/origin/release_16
  remotes/origin/release_20
  remotes/origin/release_21
  remotes/origin/release_22
  remotes/origin/release_23
  remotes/origin/release_24
  remotes/origin/release_25
  remotes/origin/release_26
  remotes/origin/release_27
  remotes/origin/release_28
  remotes/origin/release_29
  remotes/origin/release_30
  remotes/origin/release_31
  remotes/origin/release_32
  remotes/origin/stable
  remotes/origin/testing
Repeat this for clang and compiler-rt.

No comments: