Skip to content

Instantly share code, notes, and snippets.

@fabianbraun
Last active December 10, 2015 21:08
Show Gist options
  • Save fabianbraun/4493195 to your computer and use it in GitHub Desktop.
Save fabianbraun/4493195 to your computer and use it in GitHub Desktop.
My git config
[alias]
fixup = !sh -c 'git commit --fixup=$1' -
squash = !sh -c 'git commit --squash=$1' -
llog = log --date=local
gitkconflict = !gitk --left-right HEAD...MERGE_HEAD
new = !sh -c 'git log $1@{1}..$1@{0} "$@"'
stsh = !CURRENT=$(git symbolic-ref HEAD) && git symbolic-ref HEAD refs/heads/stash && git commit -a -m stashed && git checkout $CURRENT
whois = "!sh -c 'git log -i -1 --pretty=\"format:%an <%ae>\n\" --author=\"$1\"' -"
whatis = show -s --pretty='tformat:%h (%s, %ad)' --date=short
debug = !GIT_PAGER= gdb --args git
intercommit = !sh -c 'git show "$1" > .git/commit1 && git show "$2" > .git/commit2 && interdiff .git/commit[12] | less -FRS' -
graphviz = "!f() { echo 'digraph git {' ; git log --pretty='format: %h -> { %p }' \"$@\" | sed 's/[0-9a-f][0-9a-f]*/\"&\"/g' ; echo '}'; }; f"
st = status
ci = commit
br = branch
co = checkout
df = diff
lg = log -p
who = shortlog -s --
k = !gitk
fix-branch = "!f() { git diff origin/refit --name-only --diff-filter=ACMUX | xargs -i php-cs-fixer fix '{}' --config=sf21 ;}; f"
pull-current = !git pull origin $(git symbolic-ref --short HEAD)
merge-pr = "!sh -c 'git fetch --all && git reset --hard origin/$(git symbolic-ref --short HEAD) && git pull-current && git merge --no-ff -m \"Merged \\#$1\" pr/$1 && phpunit -c app/phpunit.xml.dist && git push origin $(git symbolic-ref --short HEAD)' -"
[rebase]
autosquash = true
[branch]
autosetuprebase = always
[branch "master"]
rebase = true
[remote "origin"]
fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
@DaRaFF
Copy link

DaRaFF commented Feb 6, 2013

I updated the script a little bit for more readability and i added a second parameter in merge-pr to add the jira ticket number

pull-current = "!git pull origin $(git symbolic-ref --short HEAD) \
                && git pull --rebase"
merge-pr = "!sh -c ' \
                git fetch --all \
                && git reset --hard origin/$(git symbolic-ref --short HEAD) \
                && git pull-current \
                && git merge --no-ff -m \"$2 #$1\" origin/pr/$1 \
                && bin/install.sh --env=dev \
                && phpunit -c app/phpunit.xml.dist \
           ' -"
amend = "commit --amend -C HEAD"
amend-comment = "commit --amend -m \"New commit message\""
graph = "log --graph --pretty=format':%C(yellow)%h%Cblue%d%Creset %s %C(white) %an, %ar%Creset'"
standup = "log --since '1 day ago' --oneline --author [email protected]"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment