diff --git a/git.org b/git.org index b59d036..099739b 100644 --- a/git.org +++ b/git.org @@ -72,15 +72,24 @@ General git configuration split out into sections mostly. sup = !git pull --rebase && git submodule update --init --recursive # git clone with submodules sc = !git clone --recursive $1 - # what files are getting updated a lot - churn = !git log --all -M -C --name-only --format='format:' "$@" | sort | grep -v '^$' | uniq -c | sort | awk 'BEGIN {print "count,file"} {print $1 "," $2}' + # what files are getting updated a lot descending output + churn = !git log --all -M -C --name-only --format='format:' "$@" | sort | grep -v '^$' | uniq -c | sort -r | awk 'BEGIN {print "count,file"} {print $1 "," $2}' | egrep -v '^\\s+$' # help the gc a bit and get a bit more space back for a local clone trim = !git reflog expire --expire=now --all && git gc --prune=now + # default remote defremote = !git branch -rvv | egrep 'HEAD' | awk '{print $1}' | sed -e 's|/HEAD||g' + # short sha short = rev-parse --short + # branch commits on lhs compared to rhs, use via g bcs $(g bn) ^other/branch + bcs = log --pretty="%H" --first-parent --no-merges find-merge = !sh -c "commit=$0 && branch=${1:-HEAD} && (git rev-list $commit..$branch --ancestry-path | cat -n; git rev-list $commit..$branch --first-parent | cat -n) | sort -k2 | uniq -f1 -d | sort -n | tail -1 | cut -f2" show-merge = !sh -c "merge=$(git find-merge $0 $1) && [ -n \"$merge\" ] && git show $merge" + # push branch while setting the upstream to the default remote pbr = !git push --set-upstream $(git defremote) $(git bn) + p = !sh -c 'git branch ${1:-$(git defremote)}pr$0@$(iso8601 -s) $(git ls-remote -q ${1:-$(git defremote)} | grep refs/pull-requests/$0/from | cut -c1-8)' + # kinda/sorta git pull -r without the git pull nonsense + cleanmerged = !sh -c "git branch --merged | grep -Ev '^(. master|\*)' | xargs -n1 git branch -d" + prune = !sh -c 'git cleanmerged; git fetch -p; git trim' #+END_SRC ** github #+BEGIN_SRC conf :tangle (when (eq git-p t) "tmp/.gitconfig")