Skip to content

Instantly share code, notes, and snippets.

Alias Command What to Type
git cm git commit git config --global alias.cm commit
git co git checkout git config --global alias.co checkout
git ac git add . -A git commit git config --global alias.ac '!git add -A & & git commit'
git st git status -sb git config --global alias.st 'status -sb'
git tags git tag -l git config --global alias.tags 'tag -l'
git branches git branch -a git config --global alias.branches 'branch -a'
git remotes git remote -v git config --global alias.remotes 'remote -v'
@danalmeida
danalmeida / git_editor.sh
Created April 13, 2014 19:36
Set default editor for git commits to sublime text.
git config --global core.editor "subl -w"
@danalmeida
danalmeida / .bashrc
Created April 9, 2014 00:40
custom prompt colors for SSH
\[\e[0;36m\]\u\[\e[m\]\[\e[0;32m\]@\h:\[\e[m\]\[\e[0;33m\]\w\[\e[m\]${text}$
@danalmeida
danalmeida / install.sh
Last active August 29, 2015 13:57
OS X ImageMagick & Ghostscript PHP Installation
brew tap josegonzalez/php
brew tap homebrew/dupes
brew install ghostscript
brew install php54-imagick
# create symlink for ghostscript in the /usr/bin directory
sudo ln -s /usr/local/bin/gs /usr/bin/gs
@danalmeida
danalmeida / post-receive
Created March 6, 2014 16:02
Git hook — upload files to directory after push
#!/bin/sh
GIT_WORK_TREE=/path/to/host/example.com/ git checkout -f
@danalmeida
danalmeida / instructions.md
Last active August 29, 2015 13:56
OS X: How to reset the DNS cache — http://support.apple.com/kb/ht5343

OS X: How to reset the DNS cache

Use the following Terminal commands to reset the DNS cache:

OS X Yosemite

sudo discoveryutil mdnsflushcache;sudo discoveryutil udnsflushcaches

OS X Mountain Lion or Lion

@danalmeida
danalmeida / webserver.py
Created January 20, 2014 01:42
Start a quick webserver from any directory in OS X
python -m SimpleHTTPServer 8000
@danalmeida
danalmeida / gruntfile.js
Last active May 8, 2018 21:04
boilerplate Grunt configuration
module.exports = function(grunt) {
// 1. All configuration goes here.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
dist: {
options: {
style: 'compressed'
<?php
abstract class BaseHandler {
protected $templateVariables;
public function __construct() {
$this->templateVariables = array(
'base_url' => BASE_URL
);
}
@danalmeida
danalmeida / git_reduce_repo_size.md
Last active December 31, 2015 11:49
Git Reduce Repo Size

source zuha/Zuha

When you first start working with git you typically pay no attention to the size of the repo. You commit anything and everything. Then at some point you start to realize that your repo is huge. (Our was pushing 2 gigabytes)

In order to reduce it at this future point, and keep the history here is the simplest way. Noting that we only want to keep a single branch - the master - in our case. No tags, no remote or local branches, and when we're done every one who wants to collaborate will need to delete their local repos and pull a new clone.

Therefore, this should only be done when all branches are synced, so that they can be reduced to a single master branch on both the remote repo and locally. There should be no tags.

Sync and clean

  1. git clone <GIT REPO URL> <DIRECTORY> Clone a clean version of the repository.