Skip to content

Instantly share code, notes, and snippets.

Avatar

Charlie Collett scollett

  • Oakland, CA
View GitHub Profile
View pre-push.sh
#!/bin/bash
# By https://gist.github.com/pixelhandler
# Modified by https://gist.github.com/vistik
# Called by "git push" after it has checked the remote status,
# but before anything has been pushed.
#
# If this script exits with a non-zero status nothing will be pushed.
#
@scollett
scollett / git_shortcuts.md
Created Feb 21, 2014
Tibits of git.fu that are helpful
View git_shortcuts.md

Removing a file/folder from git git filter-branch --prune-empty --tree-filter 'git rm -rf --cached --ignore-unmatch FOLDER_OR_FILES_TO_REMOVE' --tag-name-filter cat -- --all git filter-branch --prune-empty --index-filter 'git rm -rf --cached --ignore-unmatch FOLDER_OR_FILES_TO_REMOVE' --tag-name-filter cat -- --all rm -rf .git/refs/original/ git reflog expire --expire=now --all git gc --aggressive --prune=now

@scollett
scollett / gollum.config.ru
Last active Jul 20, 2017
A lightweight author identification for Gollum wiki (with some preferences). Use config.ru to run Gollum as a rack application. Basic HTTP Authentication is commented out.
View gollum.config.ru
#!/usr/bin/env ruby
require 'rubygems'
require 'gollum/app'
gollum_path = File.expand_path(File.join(File.dirname(__FILE__), 'database.git')) # CHANGE THIS TO POINT TO YOUR OWN WIKI REPO
Precious::App.set(:gollum_path, gollum_path)
Precious::App.set(:default_markup, :markdown) # set your favorite markup language
Precious::App.set(:wiki_options, {:live_preview => false, :universal_toc => false, :user_icons => 'gravatar'})
module Precious
class App < Sinatra::Base
# Creates a simple authentication layer
@scollett
scollett / remove_file_or_folder_from_git.txt
Last active Dec 19, 2015
I had to permanently remove a ginormous folder of seed data from the git repository history (moved it outside the project). I combined advice in several posts on removing folders/files till it worked. I'm not sure if you need all those parameters to both the tree and index filter, but it worked. *Note, be careful if you've already pushed to a sh…
View remove_file_or_folder_from_git.txt
git filter-branch --prune-empty --tree-filter 'git rm -rf --cached --ignore-unmatch FOLDER_OR_FILES_TO_REMOVE' --tag-name-filter cat -- --all
git filter-branch --prune-empty --index-filter 'git rm -rf --cached --ignore-unmatch FOLDER_OR_FILES_TO_REMOVE' --tag-name-filter cat -- --all
rm -rf .git/refs/original/
git reflog expire --expire=now --all
git gc --aggressive --prune=now
You can’t perform that action at this time.