Skip to content

Showcase

Benjamin Arthur Lupton edited this page May 15, 2014 · 12 revisions

A place to showcase the cool chains you've put together

Delete git branches from the remote

// Fetch the cwd's branches, and delete each of them except master from the git remote
var Chainy = require('chainy').extend().require(['exec', 'swap', 'forEach', 'done']);
Chainy.create()
	.exec('git branch --no-color')
	.swap(function(value){
		return value.replace('*', '').replace(/ /g, '').split('\n').filter(function(value){
			if ( value === 'master' )  return false;
			return true;
		});
	})
	.forEach(function(value, complete){
		Chainy.create()
			.exec(function(){
				return 'git push origin :'+value;
			})
			.done(complete)
	})
Clone this wiki locally