git
#Using git @ work & home
# ~/.gitconfig
[includeIf "gitdir:~/Work/Code/Repos/"]
path = ~/Work/Code/Repos/.gitconfig
# ~/Work/Code/Repos/.gitconfig
[user]
email = name@work-domain.com
name = Scott Lowe
[commit]
gpgsign = false
#Reading
#Recipes
#Find Large Files
# via https://stackoverflow.com/q/10622179/
git rev-list --objects --all |
git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' |
sed -n 's/^blob //p' |
sort --numeric-sort --key=2 |
cut -c 1-12,41- |
$(command -v gnumfmt || echo numfmt) --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest
#Orphant Branches
git checkout --orphan gh-pages
git rm -rf .
<do work>
git add your files
git commit -m 'Initial commit'
#Garbage Collection
git -c gc.reflogExpire=0 -c gc.reflogExpireUnreachable=0 -c gc.rerereresolved=0 \
-c gc.rerereunresolved=0 -c gc.pruneExpire=now gc
git gc --prune=now
#Rebase
# Update current branch with changes from base branch
git stash --include-untracked # Stashing uncommited
git rebase base-branch # Rebasing Changes
git stash pop # Apply stash and delete
# Or
git checkout target
git rebase base-branch
# Edit Old Commit
git rebase --interactive 'bbc643cd^'
git commit --all --amend
git rebase --continue
# Squash
git log --oneline
git rebase -i HEAD~4
#Upstream
git clone https://github.com/butuzov/kubernetes-website .
git remote add upstream https://github.com/kubernetes/website.git # Add the remote, call it "upstream":
git fetch upstream # get updates
git merge upstream/master master # merge updaes
git push -f origin master # push
#History
# What happend to `content/docs/examples/`
git log --full-history -- content/docs/examples/