Skip to content

Instantly share code, notes, and snippets.

@jpalmieri
jpalmieri / fork-upstream.sh
Created June 29, 2018 17:21
have fork track master repo upstream changes
# https://www.gun.io/blog/how-to-github-fork-branch-and-pull-request
# (run on local repo after forking)
# This step isn't absolutely necessary, but I find it very useful if you plan on working on this project for anything more than a very quick fix. Use the following commands to add the 'upsteam' (original project location) as a remote branch so that you can get their updates into your branch. Replace the 'upstreamname' and 'projectname' values with that actual user/project name that you're trying to track.
git remote add --track master upstream git://github.com/upstreamname/projectname.git
# This will add the original project as a remote named 'upstream'. To get the code, type:
git fetch upstream
# Then, to merge it into your own project, type:
@jpalmieri
jpalmieri / gist:cb6271004127633a133e9606ddba58b1
Last active July 4, 2021 13:17
git alias to prepend last commit message with '[skip ci]' (to skip a travis build)
git config --global alias.skip-ci '!git reset && COMMIT_MSG=`git show --format=format:%B -s` && git commit --allow-empty --amend -m "[skip ci] $COMMIT_MSG"'
@jpalmieri
jpalmieri / iterm_opt_fix
Created December 22, 2015 03:22
fix for iTerm2 to use opt+ left/right arrows to move between words
1. Go to iTerm Preferences → Profiles
2. select your profile, then the Keys tab
3. Find ⌥← and ⌥→ and set them to send escape sequence b and send escape sequence f respectively.
@jpalmieri
jpalmieri / fast_cursor.txt
Created December 22, 2015 03:16
super fast os x cursor
(in terminal)
defaults write NSGlobalDomain KeyRepeat -int 0
@jpalmieri
jpalmieri / git_branch_in_prompt.sh
Last active May 11, 2016 02:45
Display git branch in command line prompt
# Add the below lines to ~/.bash_profile
# Show Git branch in prompt.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \W\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ "
@jpalmieri
jpalmieri / git_autocomplete
Last active May 26, 2023 08:16
Autocomplete for git commands and branch names
Taken from this page: http://code-worrier.com/blog/autocomplete-git/
Step 1: download this bash script (make sure to name it ".git-completion.bash"):
https://github.com/git/git/blob/master/contrib/completion/git-completion.bash.
You can run this curl from your home directory to download it directly:
curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash
Step 2: Place the file in your home directory
@jpalmieri
jpalmieri / copy using braces
Created October 15, 2014 20:46
Terminal: copy a file to a version marked "old" using braces for shorthand
cp /etc/rc.conf{,-old}
@jpalmieri
jpalmieri / git lola
Created October 11, 2014 05:29
alias 'git lola' for a graphical log
git config --global alias.lola "log --all --graph --decorate --pretty=oneline --abbrev-commit"