Skip to content

Instantly share code, notes, and snippets.

@dysinger
Created April 14, 2010 05:16
Show Gist options
  • Save dysinger/365477 to your computer and use it in GitHub Desktop.
Save dysinger/365477 to your computer and use it in GitHub Desktop.
Chef-repo & Opsode Cookbooks in the same git repo
#!/bin/sh
# Demo how your can merge opscode chef-repo & cookbooks
# and perm. keep up to date with opscode cookbooks (the last "git" cmd)
% git clone git://github.com/opscode/chef-repo.git
Initialized empty Git repository in /home/tim/src/chef-repo/.git/
remote: Counting objects: 107, done.
remote: Compressing objects: 100% (99/99), done.
remote: Total 107 (delta 45), reused 0 (delta 0)
Receiving objects: 100% (107/107), 16.14 KiB, done.
Resolving deltas: 100% (45/45), done.
% cd chef-repo
% git remote add -f cookbooks git://github.com/opscode/cookbooks.git
Updating cookbooks
warning: no common commits
remote: Counting objects: 6291, done.
remote: Compressing objects: 100% (1995/1995), done.
remote: Total 6291 (delta 3435), reused 6291 (delta 3435)
Receiving objects: 100% (6291/6291), 5.09 MiB | 937 KiB/s, done.
Resolving deltas: 100% (3435/3435), done.
From git://github.com/opscode/cookbooks
* [new branch] master -> cookbooks/master
% git merge -s ours --no-commit cookbooks/master
Automatic merge went well; stopped before committing as requested
% git read-tree --prefix=cookbooks -u cookbooks/master
% git commit -m 'Merged opscode cookbooks as our chef-repo cookbooks'
[master e0f92d9] Merged opscode cookbooks as our chef-repo cookbooks
% git pull -s subtree cookbooks master
From git://github.com/opscode/cookbooks
* branch master -> FETCH_HEAD
Already up-to-date.
% # ROK!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment