Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
.gitconfig
[user]
name = Filip Procházka
email = filip@prochazka.su
signingkey = *PG KEY*
[init]
defaultBranch = master
[core]
whitespace = fix,-indent-with-non-tab,space-before-tab,trailing-space,cr-at-eol
autocrlf = input
filemode = false
excludesfile = ~/.gitignore_global
# editor = subl -n -w
editor = nano
attributesfile = ~/.gitattributes
pager = less
[pager]
log = diff-highlight | less
show = diff-highlight | less
diff = diff-highlight | less
branch = false
[branch]
autosetuprebase = always
[diff]
algorithm = histogram
mnemonicprefix = true
renames = copies
compactionHeuristic = true
# indentHeuristic = true # default from 2.18m
renameLimit = 33554432
noprefix = true
[push]
default = current
[pull]
rebase = true
[fetch]
prune = true
[advice]
statusHints = false
pushNonFastForward = false
[pack]
writeReverseIndex = true
[remote]
pushdefault = origin
[interactive]
diffFilter = diff-highlight
[commit]
gpgsign = true
[status]
showStash = true
# renames = defaults to diff.renames
# renameLimit = defaults to diff.renameLimit
[rebase]
missingCommitsCheck = warn
abbreviateCommands = true
[merge]
ff = false
# renames = defaults to diff.renames
# renameLimit = defaults to diff.renameLimit
[log]
decorate = true
date = iso
[pretty]
custom-log-oneline = "format:%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset %C(magenta)(%G?: %GS)%Creset"
[alias]
co = checkout
cp = cherry-pick
st = status
ap = add -p
ci = commit
qci = commit
cia = commit --amend
rb = rebase
rbi = rebase -i --autosquash
rba = rebase --abort
rbc = rebase --continue
rbs = rebase --skip
br = branch -vv
b = branch -vv
d = diff
dc = diff --cached
dw = diff --word-diff
mb = merge --no-ff
ff = merge --ff-only
stage = add
unstage = reset HEAD --
f = fetch --all --prune
fpush = push --force-with-lease
l = log --graph --pretty=custom-log-oneline --abbrev-commit --date=relative
ls = "l --stat -m"
lp = "l -p"
lw = "l -p --color-words"
h = !git --no-pager log --abbrev-commit --pretty=oneline upstream/master..HEAD
assume-unchanged = "update-index --assume-unchanged"
assume-changed = "update-index --no-assume-unchanged"
up = "!git stash && git fetch && git pull upstream"
pu = "up && git push upstream master"
k = !gitk
start = !git init && git commit --allow-empty -m "Initial commit"
wip = !git add --all && git commit -m 'WIP [ci skip]'
unwip = reset HEAD~1
cif = !git commit --fixup=$(git-log-vgrep-most-recent-commit 'fixup!')
cifi = !git-commit-fixup-ask
find = !sh -c 'git ls-tree -r --name-only HEAD | grep --color $1' -
cleanup = !git fetch --all --prune && git branch --merged master | grep -v '\\*\\|master\\|develop' | xargs -n 1 -r git branch -d
cf = show --pretty="format:" --name-only
permission-reset = "!git diff -p | grep -E '^(diff|old mode|new mode)' | sed -e 's/^old/NEW/;s/^new/old/;s/^NEW/new/' | git apply"
[color]
branch = auto
diff = auto
status = auto
sh = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red
new = green
whitespace = red reverse
[color "status"]
added = green
changed = red
untracked = cyan
[color "sh"]
branch = yellow
[cola]
spellcheck = false
[diff "lisp"]
xfuncname = "^(\\(.*)$"
# xfuncname = "^(\\((cl-)?def(un|macro|method).*)$"
[diff "rstats"]
xfuncname = "^([a-zA-z.]+ <- function.*)$"
[diff "texinfo"]
# from http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=blob;f=.gitattributes;h=c3b2926c78c939d94358cc63d051a70d38cfea5d;hb=HEAD
xfuncname = "^@node[ \t][ \t]*\\([^,][^,]*\\)"
[diff "orgmode"]
xfuncname = "^(\\*+.*)$"
#[diff "css"]
# xfuncname = "^([a-zA-Z#.@][^\\}]*)$"
# xfuncname = "^(.*\\{)$"
[diff "rust"] # Thanks to csabahenk
xfuncname = "^[ \t]*(pub|)[ \t]*((fn|struct|enum|impl|trait|mod)[^;]*)$"
[diff "exif"]
binary = true
# sudo apt-get install libimage-exiftool-perl
textconv = exiftool
[diff "phpf"]
xfuncname = "^[\t ]*(((public|protected|private|static)[\t ]+)*function.*)$\n"
[url "git@github.com:"]
insteadOf = "gh:"
pushInsteadOf = "github:"
pushInsteadOf = "git://github.com/"
[url "git://github.com/"]
insteadOf = "github:"
[url "git@gist.github.com:"]
insteadOf = "gst:"
pushInsteadOf = "gist:"
pushInsteadOf = "git://gist.github.com/"
[url "git://gist.github.com/"]
insteadOf = "gist:"
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
#*.jar
*.rar
*.tar
*.zip
# Logs and databases #
######################
*.log
#*.sql
#*.sqlite
# OS generated files #
######################
.DS_Store*
ehthumbs.db
Icon?
Thumbs.db
# IDE generated files #
#######################
.project
.idea
# Other #
#########
.svn
.buildpath
#!/usr/bin/env bash
if ! [ -d .git ]; then
echo "Not a git repository";
exit 1;
fi
if git diff --cached --quiet --exit-code; then
echo "Nothing to commit";
exit 1;
fi
relativeToHead=0;
for commitId in `git --no-pager log --format=%H master...HEAD`; do
commitMessage=$(git --no-pager log --format=%B -n 1 $commitId)
if [[ ${commitMessage:0:7} == "fixup! " ]] || [[ ${commitMessage:0:8} == "squash! " ]]; then
((relativeToHead++));
continue;
fi
git --no-pager log --pretty="format:${relativeToHead}. %Cred%h%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset" --date=relative -n1 $commitId;
echo
for filename in `git --no-pager diff --cached --name-only;`; do
git --no-pager diff --stat=160 --color "$commitId" "$commitId^" -- "$filename" | head -n 1;
done
((relativeToHead++));
done
if [ "$relativeToHead" -eq 0 ]; then
echo "no commits in branch found using master...HEAD range";
exit 1;
fi
((relativeToHead--))
echo;
read -p "Pick a commit [0..${relativeToHead}]: " targetCommit
if [ -z "${targetCommit##*[!0-9]*}" ]; then
echo "expected a number in range [0..${relativeToHead}]";
exit 2;
fi
if [ ! "$targetCommit" -ge 0 -o ! "$targetCommit" -le "$relativeToHead" ]; then
echo "expected a number in range [0..${relativeToHead}]";
exit 3;
fi
git commit --fixup "HEAD~$targetCommit"
#! /bin/bash
if (( $# < 1 )); then
echo >&2 "Usage: $0 pattern [<since>..<until>]"
exit 1
fi
pattern=$1
shift
git log --format=%H $@ |
grep -v -f <(git log --format=%H "--grep=$pattern" $@) |
git log -1 --format="%H" --stdin --no-walk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment