Skip to content

Instantly share code, notes, and snippets.


Igor Escobar igorescobar

View GitHub Profile
igorescobar /
Created Apr 24, 2013
Alias to add your ~/ to ~/.ssh/authorized_keys on a remote server.
# ssh-copy-id user@host
alias ssh-copy-id='_(){ ssh $1 -p 5022 "mkdir -m 700 ~/.ssh; echo " $(< ~/.ssh/ " >> ~/.ssh/authorized_keys ; chmod 600 ~/.ssh/authorized_keys"; }; _'
igorescobar / sp-celphones-no-anatel-validated.js
Last active Dec 15, 2015
Telefones de São Paulo sem as validações da Anatel
View sp-celphones-no-anatel-validated.js
// using:
// version with Anatel validation:
// version: v1.3.0+
$(".sp_celphones").mask("(00) 00009-0000");

#Vendo MacBook White (Unibody) - R$ 1.900,00

  • OS X Mountain Lion (10.8)
  • 2.4GHz Core 2 Duo (3MB L2 cache)
  • 8GB 1066 MHz DDR3 SDRAM
  • HD 250 GB Serial ATA (5400 RPM)
  • NVIDIA GeForce 9400M 256 MB of DDR3 SDRAM
  • AirPort Extreme (802.11a/b/g/n), Bluetooth 2.1+EDR standard and USB 2.0.
igorescobar /
Last active Dec 12, 2015
Aliases You Can't Live Without
co = checkout
# ds: it is always best practice to review the changes you're going to commit before making the actual commit. This allows you to catch typos, accidental inclusion of sensitive data and grouping code into logical groups. Stage your changes and then use git ds to see the diff of those changes.
ds = diff --staged
#st: you should be pretty familiar with the verbose output of git status. At some point you'll want to skip all the formality and get down to business. This alias shows the short form of status and includes the branch details.
st = status -sb
#amend: did you forget to include a file with your last commit, or maybe you had one tweak you needed to make? Amend the staged changes to your last commit.
amend = commit --amend -C HEAD
View Git Branches Sorted by Last
So you've got the cluttered branch list that we talked about before; some of those you've cleaned up with the --merged flag. But what about all those other branches? How do you know which ones are useful or entirely out of date? The for-each-ref command will output a list for each branch and show the reference information for the last commit. We can customize the output to include some useful information, but, more importantly, we can sort the list by date. This command will give us a list of branches with the last commit message and committer, sorted in descending date order. (via Rein Henrichs)
git for-each-ref --sort=-committerdate --format='%(committerdate:short) %(refname:short) [%(committername)]'
While you could type this command each time, I highly recommend making it an alias and save yourself some serious headaches.
git config --global alias.latest "for-each-ref --sort=-committerdate --format='%(c
igorescobar / gist:4730668
Created Feb 7, 2013
Grab a File from Another Branch without Switching Branches
View gist:4730668
git checkout <BRANCH> -- path/to/file.rb
igorescobar / Show Which Branches are Merged (or not).sh
Created Feb 7, 2013
Show Which Branches are Merged (or not)
View Show Which Branches are Merged (or not).sh
When working with feature branches, you can quickly create so many that clutter up the output of git branch --list. Every now and again you want to get rid of the branches that have made it into master. But you probably have a quick pause before you git branch -d <BRANCH>, but with the below commands you can confidently delete them without a second thought. (via Zach Holman)
If you want to see which local branches you have that are merged into the branch you are currently on, then all you need is:
git branch --merged
The reverse is also available. Show which branches haven't been merged into the currently selected branch with:
git branch --no-merged
Mash this up with a couple easy UNIX tools and you can quickly delete everything that has already been merged:
git branch --merged | xargs git branch -d
igorescobar / .gitconfig
Last active Apr 21, 2020
A simple way to make pair programming possible with git and doesn't loose track of who's pair programming with you.
View .gitconfig
pair = !git config \"Igor & $1\"
unpair = config --unset-all
igorescobar / git-spush.bash
Last active Apr 10, 2019
Git alias to run your maven tests before push your changes to remote
View git-spush.bash
git config alias.spush='!sh -c "mvn clean test && git push \$1 \$2 \$3"'
igorescobar /
Created Jan 8, 2013
My personal Bash's Aliases
alias ls="ls -Gi"
alias up="script/start_local_server"
alias update_hosts="cd /Users/igorescobar/Projects/alexandria-hosts/ && ./alx-hosts update"
alias rclear="bundle exec rake tmp:clear && bundle exec rake log:clear"
alias pair-with='_(){ git config "Igor e $1"; }; _'
alias unpair='git config --unset-all'