[alias] # git branch alias br = branch # git checkout alias co = checkout # git log with graph decorations on the side glog = log --graph --color --decorate # list files modified check = diff --name-only # Automated fetch and rebase alias. # By default works with origin as repository and the given argument as branch name, or master if unset. # For manual usage a different repository and a different branch name can be given as arguments. # Credits to Adam Brett for the fetch, merge and rebase alias. Edited by Riccardo Paccagnella. # We stash first so that uncommitted changes. We stash pop last to restore those uncommitted changes. # We attempt fast forward merge in an attempt to sync the tree with the repo, otherwise # we try to rebase preserving merges. # # For example: # git up # works on origin master # git up dev # works on origin dev # git up test dev # works on test dev: # up = "!f_up() { \ REPO=origin; \ BRANCH=\"${1:-master}\"; \ if [ $# -ge 2 ]; then \ REPO=\"$1\"; \ BRANCH=\"$2\"; \ fi;\ git stash && \ git fetch \"$REPO\" && \ git fetch \"$REPO\" --prune --tags && \ ( git merge --ff-only \"$REPO/$BRANCH\" || git rebase --rebase-merges \"$REPO/$BRANCH\" ) && \ git stash pop; \ }; \ f_up" # diff involving most recent commit cdiff = diff @~ @ # list already committed files being tracked by your git repo ls = ls-tree -r --name-only HEAD # information on a commit cinfo = cat-file -p # git difftool d = difftool # git mergetool m = mergetool # full fsck of the repository fullfsck = fsck --full # fix dangling commits and do a full fsck of the repository fullfix = "!f_fullfix() { \ git reflog expire --expire=now --all && \ git gc --prune=now && \ git fsck --full; \ }; \ f_fullfix" # count commits excluding merges # # The 1st sed expression removes removes empty lines, and # the 2nd sed expression removes the names of the committer. # count = "!f_count() { \ git shortlog -n | grep -v Merge | sed -e '/^$/d' -e '/^[A-Za-z].*:/d' | wc -l | tr -d ' '; \ }; \ f_count"