Skip to content

Instantly share code, notes, and snippets.

View zot24's full-sized avatar
🦑
boom!

zot24

🦑
boom!
View GitHub Profile
@rsanheim
rsanheim / ci.sh
Created March 28, 2012 05:03
Simple continuous deployment via Jenkins and Capistrano for all branches. Wire this up with Github post receive hooks from Jenkins for best results.
#!/bin/bash -x
# This should be your "script/ci" checked into version control, and then wired as your sole build step in Jenkins.
#
# Simplifying Assumptions:
#
# * You build all branches
# * You want to deploy all branches.
# * You wired up an SSH key to your CI server appropriately so it can talk to your deployment target(s) via Cap
@juanje
juanje / gist:2212077
Created March 27, 2012 02:54
Simple Chef recipe for installing Django
# Create the Cookbook
mkdir -p ~/django_guide/cookbooks/django/recipes
# Create the Recipe to install Django
cat > ~/django_guide/cookbooks/django/recipes/default.rb
python_pip 'django' do
action :install
end
^D
@juanje
juanje / gist:2210054
Created March 26, 2012 21:55
Get the opscode cookbooks for installing django with Chef-solo at Vagrant
# Create the local directory for the Cookbooks
mkdir cookbooks
# Change into the newly created ~/django_guide/cookbooks directory
cd cookbooks
# Clone the Chef Cookbooks repositories
git clone git://github.com/opscode-cookbooks/apt.git
git clone git://github.com/opscode-cookbooks/apache2.git
git clone git://github.com/opscode-cookbooks/build-essential.git
@ssp
ssp / git-extract-file.markdown
Created January 23, 2012 13:21
Extract a single file from a git repository

How to extract a single file with its history from a git repository

These steps show two less common interactions with git to extract a single file which is inside a subfolder from a git repository. These steps essentially reduce the repository to just the desired files and should performed on a copy of the original repository (1.).

First the repository is reduced to just the subfolder containing the files in question using git filter-branch --subdirectory-filter (2.) which is a useful step by itself if just a subfolder needs to be extracted. This step moves the desired files to the top level of the repository.

Finally all remaining files are listed using git ls, the files to keep are removed from that using grep -v and the resulting list is passed to git rm which is invoked by git filter-branch --index-filter (3.). A bit convoluted but it does the trick.

1. copy the repository to extract the file from and go to the desired branch