Skip to content

Instantly share code, notes, and snippets.

@cletusw
Last active July 20, 2017 19:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cletusw/ab4fa3094337212c7397 to your computer and use it in GitHub Desktop.
Save cletusw/ab4fa3094337212c7397 to your computer and use it in GitHub Desktop.
apply.whitespace fix
core.whitespace 'space-before-tab,-indent-with-non-tab,trailing-space'
core.ignorecase true
diff.renames copies
merge.ff only
merge.conflictstyle diff3
pull.ff only
push.default upstream
push.followTags true
rerere.enabled 1
credential.helper osxkeychain
user.useConfigOnly true
alias.sync '!f() { echo "$(tput setaf 4)Syncing this branch with origin master$(tput sgr 0)" && git fetch origin master && git rebase origin/master && echo "$(tput setaf 2)Branch sync successful$(tput sgr 0)"; }; f'
alias.ship '!f() { BRANCH=$(git symbolic-ref --short HEAD) && MERGE_BASE=$(git merge-base origin/master HEAD) && NUM_COMMITS=$(git rev-list --count $MERGE_BASE..) && git log --oneline --stat $MERGE_BASE.. && read -p "$(tput setaf 4)Are you sure you want to ship $(tput bold)$NUM_COMMITS$(tput sgr 0)$(tput setaf 4) commits to $(tput bold)master$(tput sgr 0)? [Y/n] " response </dev/tty && case $response in [yY][eE][sS]|[yY]|"") echo "$(tput setaf 4)Shipping branch $(tput bold)$BRANCH$(tput sgr 0)" ;; *) echo "$(tput setaf 1)Ship aborted by user$(tput sgr 0)"; return 1 ;; esac && git checkout master && (git merge --ff-only - || (echo "$(tput setaf 1)Could not merge branch into local master\nRun git sync before running this command\nIf this error persists, you have local, un-pushed commits in your master branch\nPush them to origin master or move them into a branch before running this command$(tput sgr 0)"; git checkout -; return 1)) && (git push origin master || (echo "$(tput setaf 1)Could not push branch\nRun git sync before running this command$(tput sgr 0)"; git reset --hard HEAD@{1}; git checkout -; return 1)) && echo "$(tput setaf 2)Branch ship successful$(tput sgr 0)"; }; f'
# From https://github.com/git/git/tree/master/contrib/diff-highlight:
pager.log 'diff-highlight | less -x1,3'
pager.show 'diff-highlight | less -x1,3'
pager.diff 'diff-highlight | less -x1,3'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment