Skip to content

Instantly share code, notes, and snippets.

@tgvashworth
Last active December 13, 2022 14:15
Show Gist options
  • Save tgvashworth/5403027 to your computer and use it in GitHub Desktop.
Save tgvashworth/5403027 to your computer and use it in GitHub Desktop.
.gitconfig & .gitignore
# A ~/.gitconfig file
[user]
name = YOUR NAME
email = YOUR EMAIL
[github]
user = YOUR USERNAME
token = YOUR TOKEN
[core]
quotepath = false
editor = nvim
excludesfile = /PATH/TO/YOUR/.gitignore
[http]
postBuffer = 524288000
[color]
diff = auto
status = auto
branch = auto
ui = true
[help]
autocorrect = 1
[mergetool]
keepBackup = true
[rerere]
enabled = true
[push]
default = simple
[alias]
cl = clone
co = commit
com = commit -m
# add and commit with message
coam = commit -am
# amend a previous commit
amend = commit --amend
append = commit --amend --no-edit
# nick a patch and make it your own
steal = commit --amend --reset-author --no-edit
ch = checkout
st = status
br = branch
# add in patch-mode (interactive)
ap = add -p
# undo the last commit
undo = reset --soft HEAD~1
# new branch
nbr = checkout -b
# try out a merge
drymerge = merge --no-commit --no-ff
# wipe away chnges to tracked files
clean = reset --hard
# sync up
sync = !git pull && git push
# what files changed?
changed-files = diff-tree --no-commit-id --name-only -r
# what's staged for commit?
staged = diff --cached
# log graphs
lg = log --graph --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(bold white)— %an%C(reset)%C(bold yellow)%d%C(reset)' --abbrev-commit --date=relative
# diff of what happend in the last day
todiff = !git diff $(git rev-list -n1 --before=\"1 day ago\" ${1:-master})
# summary of changes today
today = !git diff $(git rev-list -n1 --before=\"1 day ago\" ${1:-master}) --shortstat
# try out a merge
drymerge = merge --no-commit --no-ff
g = grep --break --heading --line-number
# TweetDeck
headless = !git fetch && git ch origin/master
gerrit = push publish
yolo = push review --no-verify
smash = !git steal && git yolo
# see below
splat = !gitsplat
# Node
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz
pids
logs
results
# OSX
.DS_Store
.AppleDouble
.LSOverride
Icon
# Thumbnails
._*
# Files that might appear on external disk
.Spotlight-V100
.Trashes
# Other
.sass-cache
.npm-cache
npm-debug.log
node_modules
# Personal
_HACKS.txt
_TODO.txt
_NOTES.txt
#!/bin/bash
# Cherry pick and yolo the commits origin/master..HEAD back onto origin/master
#
# So you had this:
#
# * ---- * ---- * ---- *
# ^ ^
# origin/master HEAD
#
# You'll get:
#
# origin/master
# v
# * ---- *
# |\
# | --- *
# \
# --- *
# ^
# HEAD
#
# If that's not clear, don't worry, you probably don't need this.
git fetch origin
for sha in $(git rev-list origin/master..HEAD)
do
git ch origin/master
git cherry-pick $sha
git yolo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment