From fa357e64a0ed2a1e0d99081700ad25ec1726ec45 Mon Sep 17 00:00:00 2001 From: Nemo Date: Thu, 13 Jun 2019 15:00:48 +0530 Subject: [PATCH] git commands --- git-get-commit => git-find-blob | 0 git-pushall-branches | 4 ++++ gitlistobjectbysize.sh | 16 ++++++++++++++++ 3 files changed, 20 insertions(+) rename git-get-commit => git-find-blob (100%) create mode 100755 git-pushall-branches create mode 100755 gitlistobjectbysize.sh diff --git a/git-get-commit b/git-find-blob similarity index 100% rename from git-get-commit rename to git-find-blob diff --git a/git-pushall-branches b/git-pushall-branches new file mode 100755 index 0000000..7c1d10f --- /dev/null +++ b/git-pushall-branches @@ -0,0 +1,4 @@ +#!/bin/bash +for branch in $(git branch --all | grep '^\s*remotes' | egrep --invert-match '(:?HEAD|master)$'); do + git branch --track "${branch##*/}" "$branch" +done \ No newline at end of file diff --git a/gitlistobjectbysize.sh b/gitlistobjectbysize.sh new file mode 100755 index 0000000..45de026 --- /dev/null +++ b/gitlistobjectbysize.sh @@ -0,0 +1,16 @@ +#!/bin/bash -e + +# work over each commit and append all files in tree to $tempFile +tempFile=$(mktemp) +IFS=$'\n' +for commitSHA1 in $(git rev-list --all); do + git ls-tree -r --long "$commitSHA1" >>"$tempFile" +done + +# sort files by SHA1, de-dupe list and finally re-sort by filesize +sort --key 3 "$tempFile" | \ + uniq | \ + sort --key 4 --numeric-sort --reverse + +# remove temp file +rm "$tempFile" \ No newline at end of file